Pull Cord

No dependencies
Code format

Install with shadcn

Needs a free account token. Get a token

npx shadcn@latest add @movin/toggle-cord

About this component

A hanging lamp with a pull chain. Each switch tugs the cord down and lets it spring back with a bounce, and the bulb lights (or goes out) at the bottom of the pull, throwing a soft cone of light.

Triggers

  • Click
  • State change
  • Glow
  • Spring

Techniques

  • Keyframes
  • clip-path
  • CSS transition

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 and the script skips its animation.

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

More toggles

See all
EyeGet code
FanGet code
FaucetGet code
Split FlapGet code