‹ components

Switch

stablev1.0.0·open in canvas

On/off toggle on Radix Switch.

Installnpx shadcn add @cids/switch
Live demo

Motion · tap to replay

honors reduced-motion

Track color + thumb translate, 150ms targeted; reduced-motion via global reset.

Brand chip remounts on tap · highlighted tokens are named in this component's doc · spring is budgeted to human feedback only.

import { Switch } from "@/design-system";

<Switch checked={on} onCheckedChange={setOn} aria-label="Public watchlist" />

Tokens · live

Resolves in the active theme — flip the toggle above to verify.

States · live

Forced instances — hover/focus still work on the live demo above.

off - on - focus-visible - disabled.

on

off

disabled

On/off toggle on Radix Switch.

Anatomy

(o---)  off: surface-bright track
(---o)  on: brand track, on-brand thumb

Props

PropTypeDefaultNotes
checked / onCheckedChangecontrolled pair--Caller owns state.
disabledboolean--Native semantics via Radix.
classNamestring--cn-merged onto the track.
...restRadix Switch props--e.g. aria-label, name.

Motion

Track color + thumb translate, 150ms targeted; reduced-motion via global reset.

A11y

Self-contained: copy the folder into any Tailwind+React app, or use the install command above. Docs and this page render the same file on disk — they cannot drift.