Skip to content

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

PropTypeDefaultDescription
labelstring—Visible label; wraps the switch in a <label> so it names it and is clickable.
size"sm" | "md""md"—
Configure Theme
Theme
Brand Color
Custom
Gray Family
Appearance
Radius
Scaling
Panel Style
Heading Font
Body Font