The Switch toggles a setting on or off. Built on Radix UI with full keyboard support.
Preview
Usage
Installation
$ npx shadcn@latest add https://spark-ui-olive.vercel.app/r/switch.json
Properties
| Prop | Type | Default | Description |
|---|---|---|---|
checked | boolean | — | Controlled checked state. |
onCheckedChange | (checked: boolean) => void | — | Called when the checked state changes. |
disabled | boolean | false | Disables the switch. |
className | string | — | Additional CSS classes. |