Power Button
A round power key that ignites with a flickering ring.
StandbyLive
Installation
npx shadcn@latest add https://neonkit.heyaadi.com/r/power-button.jsonUsage
import { PowerButton } from "@/components/ui/power-button"
<PowerButton pressed={on} onPressedChange={setOn} aria-label="Monitor power" />Examples
Colors and glyphs
Give each key its own color and swap the power glyph for any icon. It lights with the ring.
In a settings row
Controlled, named by the row title with aria-labelledby.
Sizes
sm, md and lg match Button's heights; xl is a 72px feature key.
API reference
Also accepts native button attributes except children. The ref points at the button.
| Prop | Type | Default |
|---|---|---|
pressed | booleanOn or off, when controlled. | None |
defaultPressed | booleanInitial state when uncontrolled. | false |
onPressedChange | (pressed: boolean) => voidCalled with the new state when the key is pressed. | None |
size | "sm"Diameter: 32, 40, 48 or 72px. | "md" |
icon | ReactNodeReplaces the glyph on the cap. It inherits the tube color through currentColor and is drawn a step larger with a 2.25 stroke so it reads inside the cap. | power glyph |
color | NeonColorPalette name or hex. Falls back to --neon-accent, then cyan. | inherited |
name | stringSubmits value under this name while on, like a native checkbox. | None |
value | stringSubmitted with name while on. | "on" |
disabled | booleanDims the key and blocks presses. | false |
Accessibility
- A toggle button: aria-pressed reflects the state, and Enter or Space toggles it.
- Without aria-label or aria-labelledby it is named "Power". Name it after what it powers when there is more than one.
- The ignition plays only when the key turns on; a key that is already on when it mounts stays steady.
- Under prefers-reduced-motion the ring fades on without flickering.