Components
Switch
On/off control with token-driven track, thumb, and press motion.
Composition
On/off control
- <Switch />
Installation
The Control UI source installs this primitive from src/registry/sources/control-ui/ui/switch.tsx.
Dependencies
Use switch drag
src/registry/sources/control-ui/ui/use-switch-drag.tsSupportRaw code
Primary installed source
Knobs
Typed custom properties the recipe paints with. Set one on the root — style, a utility class, or a skin — and every slot inherits it.
--cui-switch-* · 19 knobsHow the cascade resolves--cui-switch-thumb-shadow*var(--shadow-sm)--cui-switch-radius<length-percentage>9999px--cui-switch-shadow*0 0 transparent--cui-switch-background<color>oklch(from var(--foreground) l c h / 0.14)--cui-switch-border-color<color>var(--control-boundary)--cui-switch-border-width<length>var(--control-rim-width)--cui-switch-checked-border-color<color>transparent--cui-switch-hover-background<color>oklch(from var(--foreground) l c h / 0.2)--cui-switch-checked-background<color>var(--primary)--cui-switch-checked-hover-background<color>color-mix(in oklch, var(--primary) 90%, var(--foreground))--cui-switch-thumb-radius<length-percentage>9999px--cui-switch-thumb-background<color>var(--background)--cui-switch-inline-size<length-percentage>calc(var(--spacing) * 9)--cui-switch-height<length-percentage>calc(var(--spacing) * 5)--cui-switch-padding<length-percentage>calc(var(--spacing) * 0.5)--cui-switch-thumb-inline-size<length-percentage>calc(var(--spacing) * 4)--cui-switch-thumb-press-inline-size<length-percentage>calc(var(--cui-switch-thumb-inline-size) * 1.25)--cui-switch-thumb-press-scale<number>1--cui-switch-thumb-backdrop-filter*none