Component packs › Switchyard › Breaker Switch

Breaker Switch

When your action fails it trips: the lever kicks to the middle, the flag hatches and the module jolts; it resets by going off first.

Breaker Switch 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: trip state, async action check, test button.

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.

Breaker Switch props

PropTypeDefaultDescription
action(on: boolean) => boolean | void | Promise<boolean | void>Runs when switched on; return false (or reject) and the breaker trips instead of staying on.
onTrip() => voidCalled when it trips.
ratingstring"C16"Rating printed on the module. Default "C16".

Methods on the ref

Use it in React

import BreakerSwitch from './BreakerSwitch';

<BreakerSwitch />

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

More in Switchyard

Good for: Skeuomorphic UI.