Switch
Toggle a single setting on or off.
Installation
import { Switch } from "~/components/ui/Switch";Usage
<Switch defaultChecked />
<Switch />API reference
| Prop | Type | Default | Description |
|---|---|---|---|
| checked | boolean | - | Controlled checked state. |
| defaultChecked | boolean | false | Uncontrolled initial state. |
| onCheckedChange | (checked: boolean) => void | - | Called when the state changes. |
| disabled | boolean | false | Disable the switch. |
Accessibility
- Built on the Base UI Switch primitive: full keyboard support and role=switch.
- State is exposed via data-checked / data-disabled attributes for styling.