Toggle
Base UIA button that represents a pressed or unpressed state.
ReadyResponsive
Usage
Package export"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
| Prop | Type / description | Default |
|---|---|---|
children | ReactNodeComponent content and composition slots. | - |
className | stringAdditional 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.