Skip to content

No.95 · Controls

Lever Switch

A toggle built like a mechanical lever: the arm swings on a brass pivot, overshoots into its detent, and lights a lamp.

The prompt

Copy this text

Automatic copying is unavailable. Copy the selected text using your device’s copy command.

The design brief behind this component — reuse it to regenerate, remix, or explain it.

Design a settings toggle that feels like a piece of equipment. A 68×40px recessed plum housing with a hairline border and inner shadow holds a slim black slot with a small detent tick at each end. A metal arm (3px, brushed-steel gradient, round chrome knob at its tip) is pinned to a brass pivot at the left end of the slot. Off: the arm points up-left at −38°. On: it swings to horizontal (0°) along the slot. The swing takes 420ms with an overshooting curve (cubic-bezier(0.34,1.7,0.5,1)) so the arm snaps past its stop and settles into the detent like a real switch. A tiny indicator lamp in the housing's top-right corner is dim when off and glows frost blue when on, and the housing border warms to frost. Use a real <button role="switch"> with aria-checked, tied to a visible <label> and optional description; disabled state dims to 45% with a not-allowed cursor. Reduced motion makes the swing instant. Implementation requirements: Use React and TypeScript. Keep the component self-contained, with uniquely scoped CSS and no animation libraries. Include required imports, styles and font setup in the result. Interaction: Click, tap, Space or Enter toggles. Clicking the label also toggles. Motion: Arm swing 420ms with overshoot; lamp fade 300ms; border 300ms. Accessibility: role=switch with aria-checked, label association via htmlFor, description via aria-describedby, visible focus ring, disabled state. Responsive behavior: Fixed-size control, fluid text beside it. Preserve keyboard access, visible focus and reduced-motion behavior. Keep fictional demo data and simulated service calls in a separate usage example; expose callbacks for real actions and recover from rejected requests. Keep usage-example links inside the demo: use local buttons or prevent navigation. Demonstration links must not navigate to Vitrine routes or open other pages; preserve real URL support in the reusable component itself. Verify the result at narrow and wide viewport sizes, with keyboard input and reduced motion enabled.

Notes

Interaction
Click, tap, Space or Enter toggles. Clicking the label also toggles.
Motion
Arm swing 420ms with overshoot; lamp fade 300ms; border 300ms.
Accessibility
role=switch with aria-checked, label association via htmlFor, description via aria-describedby, visible focus ring, disabled state.
Responsive
Fixed-size control, fluid text beside it.