Lens

No dependencies
Code format

Install with shadcn

Needs a free account token. Get a token

npx shadcn@latest add @movin/toggle-lens

About this component

A switch with a liquid glass thumb: as it moves, the white thumb swells and turns to clear glass so you see the track through it, then settles back solid at the other end, where the track has filled blue.

Triggers

  • Click
  • State change
  • Morph

Techniques

  • Keyframes
  • CSS transition
  • Gradient

Difficulty

Intermediate

Accessibility

Keyboard and screen readers

A native checkbox with role="switch" inside a <label>, named by aria-label ("Wi-Fi"); :focus-visible outlines the track.

Reduced motion

The transitions and loops stop and the component jumps straight to its final state.

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

More toggles

See all
NotifyGet code
PeachGet code
PlanktonGet code
StandbyGet code