Caps Lock

No dependencies
Code format

Install with shadcn

Needs a free account token. Get a token

npx shadcn@latest add @movin/toggle-caps

About this component

A latching keycap. Pressing it sinks the key into its well with a little overshoot and it stays half down while on, with the LED in its corner lit; pressing again pops it back up. Pure CSS on a native switch.

Triggers

  • Click
  • State change
  • Glow

Techniques

  • CSS transition
  • Transform only

Difficulty

Beginner

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
Pull CordGet code
EyeGet code
FanGet code
FaucetGet code