Lens
Markup where the component goes, CSS in your stylesheet, script before </body>. In Vue, Svelte or Angular, call initToggleLens(el) on the mounted element instead.
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-lensAbout 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