Rotary

No dependencies
Code format

Install with shadcn

Needs a free account token. Get a token

npx shadcn@latest add @movin/toggle-rotary

About this component

A knurled knob that turns a quarter turn between OFF and ON and snaps into its detent with a little overshoot, while an arc around it fills from one mark to the other. Pure CSS on a native switch.

Triggers

  • Click
  • State change
  • Spring
  • Draw

Techniques

  • stroke-dashoffset
  • Conic gradient
  • SVG

Difficulty

Intermediate

Accessibility

Keyboard and screen readers

Native checkbox with role="switch" inside a <label>. The visible label text names it. Focus ring on the visual via :focus-visible.

Reduced motion

The change is instant.

Use it in anything you build, commercial and client work included. Licence

More toggles

See all
SeesawGet code
ShifterGet code
SleepGet code
ZipperGet code