007
Switch
FormOff
Customize
State
Disabled
Label
Code
<Switch>Notifications</Switch>
Install
npx shadcn@latest add https://components.haedong.dev/r/switch.json
Props
Extends the native input props (checked, defaultChecked, onChange, name, …); the input carries role="switch". Renders a <label> around it, so children is the label text.
| Prop | Type | Description |
|---|---|---|
| children | ReactNode | Label text. Omit for a bare switch and pass aria-label instead. |
| disabled | boolean | Native disabled; dims the item to 40% and drops pointer events. |
| className | string | Extra classes for the wrapping label. |