Hold Button
betaA button that confirms only after being held: ink sweeps across it while pressed, drains back if let go, and settles into a tick when the hold completes.
- Forms
- 1 file
- 1 npm package
- Accessibility notes
pnpm dlx @dowel-ui/cli add hold-buttonnpm packages installed: class-variance-authority.
import { HoldButton } from "@/components/ui/hold-button";Default
Destructive
Stays Confirmed
Sizes
Quick
Disabled
<HoldButton>
| Prop | Type | Default |
|---|---|---|
announcementAnnounced on confirmation. Defaults to | string | — |
confirmedLabelShown once confirmed. | ReactNode | "Confirmed" |
hintInstructions attached with aria-describedby. | string | "Press and hold to confirm." |
holdDurationMilliseconds the button must be held. Default 1200. | number | 1200 |
iconGlyph beside the label; a tick replaces it on confirmation. | ReactNode | — |
labelResting label, and the button's accessible name. | ReactNode | "Hold to confirm" |
onConfirmCalled once when a hold completes. | () => void | — |
onHoldCancelCalled when a hold is let go before it completes. | () => void | — |
onHoldStartCalled when a hold begins. | () => void | — |
resetAfterMilliseconds after confirming before it returns to rest. Omit to stay confirmed. | number | — |
variant | "default" | "destructive" | "default" |
8/8
checks passed
- Tested — passes
- axe assertion — passes
- Keyboard tested — does not apply
- Storybook examples — passes
- Accessibility documented — passes
- Semantic tokens only — passes
- Motion from tokens — passes
- className merged — passes
- Visible focus — does not apply
- No fixed widths — passes