Switch
Base UIAn immediate on or off preference.
ReadyResponsive
Usage
Package export"use client"
import { Label } from "@jnpll/elements-ui/label"
import { Switch } from "@jnpll/elements-ui/switch"
export function SwitchDemo() {
return (
<div className="flex items-center space-x-2">
<Switch id="airplane-mode" />
<Label htmlFor="airplane-mode">Airplane Mode</Label>
</div>
)
}
export default SwitchDemo;
Examples
Disabled state
API Reference
| Prop | Type / description | Default |
|---|---|---|
checked / defaultChecked | booleanControlled or initial checked state. | false |
onCheckedChange | functionReceives checked-state changes. | - |
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.