Signature
Hold to confirm
Confirm destructive actions by holding.
Delete a workspace
Press and hold the button. A red fill sweeps across; let go early and it drains back. Hold it through and a check pops. A quick click does nothing.
Press and hold for 1.2 seconds to confirm. Release early to cancel.
Hold for 1.2 seconds. Let go early to cancel.
When to use
- Destructive or irreversible actions where a confirmation dialog would be too heavy: delete a workspace, revoke a key, close an account.
- Touch and pointer interfaces where a double-click guard would be easy to trip.
- If the user should read what they are about to lose, a dialog or
ConfirmMorphis a better fit — holding confirms intent, not understanding.
Duration and sizes
The default is 1.2 seconds. Shorten it for low-stakes actions, lengthen it for the ones that really matter. The accessible description updates with it.
Press and hold for 0.8 seconds to confirm. Release early to cancel.Press and hold for 2 seconds to confirm. Release early to cancel.
API
HoldToConfirm
| Prop | Type | Default | Description |
|---|---|---|---|
| onConfirm | () => void | — | Called once, when the hold completes. |
| duration | number | 1200 | Milliseconds to hold. |
| doneLabel | ReactNode | 'Deleted' | Label after completing. |
| leadingIcon | ReactNode | — | Icon before the label. |
| description | string | — | Accessible description. Defaults to "Press and hold for N seconds to confirm." |
| resetAfter | number | 1600 | Milliseconds before returning to idle. 0 keeps it done. |
| onHoldStart / onHoldCancel | () => void | — | The hold began / was released early. |
| variant, size | ButtonProps | 'outline' | Same as Button. The fill is always the destructive colour, so outline, ghost or secondary read best. |
Keyboard
| Key | Action |
|---|---|
| Space (hold) | Starts the hold; releasing early cancels. |
| Enter (hold) | Same as Space. |
Accessibility
- A native button described by an accessible text: “Press and hold for 1.2 seconds to confirm. Release early to cancel.”
- Keyboard users hold Space or Enter; losing focus or moving the pointer off the button cancels.
- Assistive technology that activates the button with a plain click (no key, no pointer) starts a full timed hold, so nothing is unreachable — it still cannot confirm instantly.
- The result is announced through a polite live region. Text keeps contrast on both halves of the sweep: destructive text on the surface, destructive foreground on the fill.
Motion
- Press: the button sinks to scale .97 on
--ui-spring-snappywhile held (pointer or keyboard). - Fill: a clipped copy of the label on the destructive fill is revealed left to right with a linear clip-path animation lasting exactly `duration`, so the text is never squashed.
- Release early: the fill drains back from where it was in 160–420ms (longer the further it got), ease-out.
- Done: the button pops 0.97 → 1.035 → 1 over 360ms, the label morphs (width spring 550ms, 2px-blur crossfade) and the check draws in 320ms.
- Reduced motion: the fill still tracks the hold (it is the state), but there is no press scale, no pop, no drain and the label swaps with a 1ms fade.