Beam

No dependencies
Code format

Install with shadcn

Needs a free account token. Get a token

npx shadcn@latest add @movin/toggle-beam

About this component

A metal hilt as a switch. Switching on shoots a blade of white light out of the emitter with a soft halo that hums (a faint flicker) while it is lit, and the button on the hilt glows; switching off draws the blade back in, faster than it came out. Pure CSS on a native switch.

Triggers

  • Click
  • State change
  • Glow

Techniques

  • Keyframes
  • CSS transition
  • Filter

Difficulty

Intermediate

Accessibility

Keyboard and screen readers

Native checkbox with role="switch" inside a <label>. The input has aria-label "Beam". 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
BlindsGet code
CandleGet code
Caps LockGet code
Pull CordGet code