Pull-Cord Lamp Toggle
A pendant lamp switched by its pull cord: drag the bead down until it clicks, the cord snaps back elastically and sways, the shade rocks on its wire and the bulb warms into a cone of light with drifting dust.
Try it: Drag the cord bead down and let go — or focus it and press Space.
Installation
Install with the shadcn CLI:
npx shadcn@latest add https://www.framekitui.live/r/pull-cord-lamp-toggle.jsonOr, with the @framekit namespace registered: npx shadcn@latest add @framekit/pull-cord-lamp-toggle. You can also copy the source into components/ui/pull-cord-lamp-toggle.tsx (view on GitHub).
Usage
import { PullCordLampToggle } from '@/components/ui/pull-cord-lamp-toggle'Props
| Prop | Type | Default | Notes |
|---|---|---|---|
checked | boolean | — | Controlled on/off state. |
defaultChecked | boolean | false | Uncontrolled initial state. |
onCheckedChange | (checked: boolean) => void | — | Fires when the value flips. |
disabled | boolean | false | Disables pointer and keyboard. |
label | string | 'Reading lamp' | Accessible name and caption. |
height | number | 300 | Scene height in px. |
Dependencies
motion
Related Toggles components
- Watchful Eye Toggle
A soft eye opens and closes; the pupil tracks when open.
- Theme Reveal Toggle
A sky-to-night switch: the sun rolls behind a crescent, clouds give way to stars, and the theme change blooms out of the switch as a circular View Transition reveal. Instant swap under reduced motion.
- Day Night Capsule
Illustrated mini sky that morphs day↔night.
- Weather Vane Toggle
Vane pivots; grain shifts with wind.
- Glass Orb Switch
Translucent glass sphere slides on a dark track.
- Tideglass Toggle
Waterline rises and falls in a glass pane.