Seesaw

No dependencies
Code format

Install with shadcn

Needs a free account token. Get a token

npx shadcn@latest add @movin/toggle-seesaw

About this component

The track is a seesaw on a pivot and the thumb is a ball. Switching tips the beam the other way and the ball rolls downhill to the low end, picking up speed and actually rotating as it rolls (the stripe on it turns by the distance over its radius), then settles. Pure CSS on a native switch.

Triggers

  • Click
  • State change
  • Spring

Techniques

  • CSS transition
  • Transform only

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
ShifterGet code
SleepGet code
ZipperGet code