Pull Cord
betaA lamp switch whose cord stretches down on a spring when pulled and turns a warm light on or off.
- Forms
- 1 file
- 2 npm packages
- Accessibility notes
Loading the example…
pnpm dlx @dowel-ui/cli add pull-cordnpm packages installed: class-variance-authority, radix-ui.
import { PullCord } from "@/components/ui/pull-cord";Default
Demo Story
Sizes
<PullCord>
| Prop | Type | Default |
|---|---|---|
glowColour of the light, any CSS colour. Defaults to the warning token. | string | — |
size | "sm" | "md" | "lg" | "md" |
Every prop of Radix UI’s Switch.Root, plus className.
Built on the Radix switch primitive: role="switch" with aria-checked, toggled by click, Space or Enter, with a visible focus ring and a hidden input inside forms. The lamp drawing is aria-hidden and has no visible text, so the switch is named "Lamp" by default; pass aria-label or aria-labelledby for its real purpose. The state is carried by aria-checked, not by the glow alone. Under reduced motion the cord does not stretch and the light switches at once. The drawing never mirrors in right-to-left layouts.
10/10
checks passed
- Tested — passes
- axe assertion — passes
- Keyboard tested — passes
- Storybook examples — passes
- Accessibility documented — passes
- Semantic tokens only — passes
- Motion from tokens — passes
- className merged — passes
- Visible focus — passes
- No fixed widths — passes