Usage
import { Switch } from "@desk/ui/components/switch";Best practices
Use
Switchfor an instantly-applied on/off setting; useCheckboxfor opt-ins confirmed by a submit, andRadioGroupfor mutually-exclusive choices.Controlled use needs
checked+onCheckedChange; with onlycheckedthe switch won't move — usedefaultCheckedfor uncontrolled.Switchhas no built-in label — associate aLabelviahtmlFor/idso the toggle has an accessible name.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| size | ResponsiveSize | "lg" | Switch size — a single token or a per-breakpoint object like
|