Hold to confirm a heavy action: the pill's cap compresses like a pinball plunger, then fires its ball into the ring beside it, which becomes the status.
Hold to deploy v2.14.0 to production, or activate twice. Release early to cancel.
Ready for productionDeploying v2.14.0…Live on productionDeploy failed
Hold to deploy · release early to cancel3 regions, 0 errorsHold again to retry
plunger-button · , lively
plunger-button-demo.tsx
When to use
Use it for a heavy action that a stray click must not trigger. The person holds the pill until it fires; releasing early cancels. Assistive tech can click twice within 4 seconds instead of holding.
When not to use
For a light action use Action Button. For a two-step confirm that shows consequences use Safety Cover.
Use Plunger Button for a heavy action that a stray click must not trigger: deploy to production, publish, send to everyone. The person holds the pill; its right cap compresses like a pinball plunger and the compression is the progress. At full charge the ball fires into the ring beside it, which stays as the status of the run. Releasing early cancels. For a confirmable-in-two-clicks action use Safety Cover; for a harmless action, a regular button. The ring's room is reserved, so nothing moves.
import { PlungerButton } from "@/components/ui/plunger-button"export function DeployAction() { return ( <PlungerButton hint="Hold to deploy. Release early to cancel." onCommit={() => deploy()}> Deploy to prod </PlungerButton> )}
The children are the label, which never moves. onCommit runs at full charge; return a promise and the ball waits in the ring while it runs (aria-busy), then shows a check when it resolves or an exclamation mark on a destructive ring when it rejects. Holding again after an error re-arms the shot. For a controlled status use state and onStateChange (idle, running, done, error); setting idle returns the ball to the cap. resetAfter (ms or false) returns to idle after done.
Presets: plunger (default, 900 ms hold, 64 px shot), quick (600 ms, 48 px shot, lighter actions in dense tables) and heavy (1.5 s, 32 px compression, 88 px shot, irreversible actions). holdMs overrides the hold. The hold is a safety time: temperament never scales it. hint is the accessible instruction, progressLabel names the hidden progress bar and announcements sets what the live region says (armed, running, done, error). ball replaces the shot's shape.
Set the character for the whole app with MotionKitProvider, or per instance with temperament (calm, lively, playful). It changes motion intensity only, never the drawing.
A native button described by the hint. An sr-onlyrole="progressbar" reports the charge from 0 to 100.
Click path for screen readers, voice control and switch access, which send clicks rather than holds: a click arms the plunger and announces "Activate again to confirm"; a second click within 4 seconds fires it (the cap compresses quickly on its own). A second click under 350 ms is treated as an accidental double-click and ignored; the click that ends a hold never arms.
A polite live region announces the armed state and the run: running, done, error (announcements).
aria-disabled while the shot is out or the status is done; aria-busy while running.
The ball, the ring and the housing are aria-hidden; the status is also carried by the check or exclamation mark inside the ball.
The pill uses primary; the error ring uses destructive. Label contrast stays at least 4.5:1 in both themes. Focus shows a 3 px ring.
No compression or flight: a thin bar under the label fills during the hold. On commit the ball fades out of the cap and into the ring, which fades to primary.
One requestAnimationFrame loop, alive only while something moves. The cap moves through its right offset rewritten per frame, a declared exception so the round ends do not bend.
The ball and the ring use transform and opacity; the geometry is measured from the cap, never from the label.
Context menu and text selection are suppressed during a touch hold.
Technical sheet
Motion
calm
260 ms · bounce 0
lively
400 ms · bounce 0.3
playful
540 ms · bounce 0.45
Main spring of each temperament. Set it with the temperament prop or MotionKitProvider; the default is lively.
Size
Not measured yet · budget 6.0 kB gzip
Component and MotionKit helpers; excludes react, react-dom.
Dependencies
motion
Triggers
press, a loading state, an app event
Reduced motion
No compression, flight or squash: a thin bar under the label fills during the hold, then the ball fades out of the cap and into the ring, which fades to primary.
Keyboard
Space / Enter (hold)
Charges the plunger while held; at full charge it fires and onCommit runs
Space / Enter (release early)
Cancels: the cap eases back and nothing happens
Click, then click again
Screen readers and voice control: the first click arms and announces it, a second within 4 s fires
Tab
Moves focus to the button; leaving it mid-charge cancels
Browsers
Last 2 versions of Chrome, Edge, Firefox and Safari (iOS 16.4+)