Component packs › Switchyard › Railway Lever

Railway Lever

Grab it and the catch lifts out of its notch; the heavy lever lags your hand, swings over and drops into the far notch with a clunk.

Railway Lever is a toggle from Switchyard, a component pack with 8 toggle switches: Toggle switches that work like the real hardware: rockers, bolts, breakers, keys and levers. Price: $2 for the whole pack.

Built with: heavy lever physics, latch and notch, drag or click.

Code: React and Next.js (TypeScript), Vue 3, plain HTML/CSS/JS, Tailwind CSS v4 and Motion (motion.dev). No npm packages needed. Keyboard accessible, with a reduced-motion version, in dark and light.

Railway Lever props

PropTypeDefaultDescription
numberstring"14"Number on the lever's plate. Default "14".
positions[string, string]["Normal", "Reverse"]Printed names of the two positions. Default ["Normal", "Reverse"].

Use it in React

import RailwayLever from './RailwayLever';

<RailwayLever />

The Vue, HTML, Next.js, Tailwind and Motion versions take the same options.

More in Switchyard

Good for: Skeuomorphic UI.