Toggle

Base UI

A button that represents a pressed or unpressed state.

ReadyResponsive

Usage

Package export
tsx
"use client"

import { BookmarkIcon } from "lucide-react"

import { Toggle } from "@jnpll/elements-ui/toggle"

export function ToggleDemo() {
  return (
    <Toggle aria-label="Toggle bookmark" size="sm" variant="outline">
      <BookmarkIcon className="group-aria-pressed/toggle:fill-foreground" />
      Bookmark
    </Toggle>
  )
}

export default ToggleDemo;

Examples

Disabled state

API Reference

PropType / descriptionDefault
childrenReactNode

Component content and composition slots.

-
classNamestring

Additional classes, merged with the component styles.

-

Composition & accessibility

Import the composition slots shown in the example. Keep labels and descriptions meaningful; interactive primitives provide keyboard and focus behavior. See the source for the complete typed API.