Component packs › Switchyard › 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.
| Prop | Type | Default | Description |
|---|---|---|---|
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 | () => void | Called when it trips. | |
rating | string | "C16" | Rating printed on the module. Default "C16". |
readonly tripped: booleantrip(): void: Trips the breaker (as a failed action or the Test button would).import BreakerSwitch from './BreakerSwitch';
<BreakerSwitch />The Vue, HTML, Next.js, Tailwind and Motion versions take the same options.
Good for: Skeuomorphic UI.