Detent
Markup where the component goes, CSS in your stylesheet. No JavaScript.
Paste into Claude, ChatGPT or Cursor after filling in {{USER_STACK}}, {{USER_STYLING}} and {{USER_CONSTRAINTS}}. Neutral keeps the greys you see here; Match my project asks the model to map them onto your own colour tokens.
Install with shadcn
Needs a free account token. Get a token
npx shadcn@latest add @movin/toggle-detentAbout this component
A three-position selector: a chrome ball clicks between Off, Auto and On along a dark slot, with a light under it that is out at Off, amber at Auto and green at On.
Triggers
- Click
- State change
- Spring
- Glow
Techniques
- CSS variables
- Radial gradient
- CSS transition
Difficulty
Intermediate
Accessibility
Keyboard and screen readers
A radiogroup named by aria-label ("Ventilation") holding three native radio inputs, each inside its own <label> with visible text (Off, Auto, On); arrow keys move between them as with any radio group, and :focus-visible outlines the slot.
Reduced motion
The ball and the light change without moving.
Use it in anything you build, commercial and client work included. Licence