Switch
primitiveToggle a single boolean. Controlled or uncontrolled, with optional label + description.
Installation
$pnpm dlx disenio add switchUsage
example.tsx
import { Switch } from "@/components/ui/switch";Controlled
API
| Prop | Type | Default | Description |
|---|---|---|---|
| checked | boolean | — | Controlled value. |
| defaultChecked | boolean | false | Uncontrolled initial value. |
| onCheckedChange | (v: boolean) => void | — | Fires when toggled. |
| disabled | boolean | false | Disable interaction. |
| label | string | — | Optional label rendered next to the control. |
| description | string | — | Optional sub-label below the label. |