Detent

No dependencies
Code format

Install with shadcn

Needs a free account token. Get a token

npx shadcn@latest add @movin/toggle-detent

About 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

More toggles

See all
DishGet code
DuvetGet code
FaderGet code
FlatGet code