Components/Switch

Forms component

Switch

Chunky ink-bordered toggle. Square knob slams from left (off) to right (on) with SLAB snap motion. Track fills with color when active. Optional inline label. Use for on/off settings, not for form submissions — use Checkbox for those.

FormControlled4 colorsLabel propSnap motion
components/forms/Switch.jsx
Interactive — click to toggle
All switches are live
Fill colors
color prop — 4 options, only visible when on
States
off · on · disabled off · disabled on
Switch vs Checkbox
Choosing the right component
Props
PropTypeDefaultDescription
checkedbooleanControlled on/off state.
defaultCheckedbooleanfalseInitial state for uncontrolled usage.
onChange(checked: boolean) => voidCalled with the new state on toggle.
labelstringnullInline label — clicking it also toggles. Renders a flex wrapper when provided.
color"violet"|"lime"|"pink"|"neon""violet"Track fill color when on.
disabledbooleanfalseMutes to 45% opacity, disables interaction.
styleCSSProperties{}Merged onto the root element.
Usage
import { Switch } from "components/forms/Switch";

// Uncontrolled with label
<Switch label="Enable notifications" />

// Controlled
<Switch
  checked={darkMode}
  onChange={setDarkMode}
  label="Dark mode"
  color="lime"
/>

// No label (standalone)
<Switch checked={active} onChange={setActive} />