← All components Form primitives
Switch
Immediate-effect on/off toggle. role=switch + aria-checked. Apple HIG: switches for immediate, checkboxes for deferred.
Inspired by Apple HIG Toggles, Radix Switch, WAI-ARIA APG.
Preview
What it looks like.
Live — the real component, scoped to this frame.
Usage
Drop it into your app.
import { Switch } from '@locara/components'
<Switch
checked={streaming}
onCheckedChange={setStreaming}
aria-label="Stream tokens to UI"
/>
Or copy the source into your repo:
locara add switch
Design notes
Why it works this way.
Apple HIG is firm: if flipping the control instantly does the thing, use Switch. If the value applies only at form-submit time, use Checkbox. Toggled with Space or Click; thumb animates with cubic-bezier(0.16, 1, 0.3, 1).