Switch
Turns a setting on or off, with an optional label. The thumb slides across the track when toggled.
// Radix — @radix-ui/react-switch
import { Switch } from "@shavin/ui";Sizes
Component Source
<Switch aria-label="Email notifications" size="sm" checked={sm} onCheckedChange={setSm} />
<Switch aria-label="Email notifications" size="md" checked={md} onCheckedChange={setMd} />Disabled
Component Source
<Switch aria-label="Email notifications" size="md" checked disabled />
<Switch aria-label="Email notifications" size="md" checked={false} disabled />Props
| Prop | Type | Default | Description |
|---|---|---|---|
| label | string | — | Visible label; wraps the switch in a <label> so it names it and is clickable. |
| size | "sm" | "md" | "md" | — |