Hold Button
rAFA destructive action that needs a press and hold, with a fill that shows progress.
Confirmed 0 times
Install
$ npx shadcn@latest add https://spotcheckui.com/r/hold-button.jsonNo motion engine needed.
Usage
import { HoldButton } from "@/components/spotcheck/hold-button"
<HoldButton duration={1200} onConfirm={deleteWorkspace}>Hold to delete</HoldButton>Letting go early cancels. Once confirmed, screen readers hear "Confirmed" and pressing again resets it.
Props
- duration
numberDefault 1200How long to hold, in milliseconds. - onConfirm
() => voidDefault —Runs once the hold completes. - confirmedLabel
stringDefault Done · press to resetReplaces the label after the hold completes. Pressing again resets the button.
Keyboard
| Space | Hold to confirm |
|---|---|
| Enter | Hold to confirm |
Reduced motion
The fill stays, because it's the only sign of how long is left. Nothing else moves.