Switch
A control that allows the user to toggle between checked and not checked.
Installation
npx neobrutal add switch
Usage
import { Switch } from "@/components/ui/switch"import { Label } from "@/components/ui/label"
<div className="flex items-center gap-2"><Switch id="airplane-mode" /><Label htmlFor="airplane-mode">Airplane Mode</Label></div>
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| checked | boolean | - | The controlled checked state of the switch. |
| defaultChecked | boolean | - | The default checked state when uncontrolled. |
| onCheckedChange | (checked: boolean) => void | - | Event handler called when the checked state changes. |
| disabled | boolean | - | When true, prevents the user from interacting with the switch. |