Put the action in onConfirm: it runs only after a full hold.
delete-project.tsx
HoldButton
<div>| Prop | Type | Default | Description |
|---|---|---|---|
| class | string | — | |
| busy | boolean | — | The button waits for the app (busy words): a spinner, aria-busy, and no clicks. Focus stays on the button. The style hook stays data-loading. |
| glass | "clear""dark""light" | — | |
| rounded | "default""full" | — | |
| size | "default""icon""icon-lg""icon-sm""icon-xs""lg""sm""xl""xs" | "default" | |
| variant | "default""destructive""destructive-outline""outline""secondary" | "default" | |
| duration | number | — | A full hold in ms. Default 1500; at least 200. |
| on | — | A press started to fill. | |
| on | — | A press ended before the end: the fill drains. | |
| on | — | The hold reached the end (or a screen reader click, or actionsRef.current.confirm): run the action. The name of the Swipe to Confirm prop. Return a promise to stay pending until it settles: it resolves to done and rejects to error. Show the reason of an error yourself (a Toast). | |
| status | "done""error""idle""pending" | — | The status (controlled). Set it from onStatusChange, or the fill drains. |
| default | "done""error""idle""pending" | — | The status at first (uncontrolled). |
| on | — | ||
| reset | number | — | Back to idle this many ms after done (an action that can run again). |
| actions | — | Confirm or reset from code. | |
| haptics | boolean | — | A 10ms vibration when the hold completes, where the browser has one (Android). Default true. |
| children | ConfirmContent | — | The label at rest ("Hold to delete"), with an icon if you like. The other statuses show a spinner, a check, and statusText. A function of the status gives every status its own content instead; where it returns null, that status keeps its built-in content. |
| status | — | The words of pending, done, and error. Defaults (English): "Confirming", "Confirmed", "Retry". | |
| glow | boolean | — | A soft halo in the fill color that grows with the fill (glow, @gelatin-ui/glow). Default: false. |
| ...props | <div> attributes | — | Every other attribute goes to the <div>, with a ref. |
| SpaceorEnter | Hold: fills while held; a full hold runs the action. Let go early and the fill drains. |
|---|---|
| Escape | While held: stops the hold and drains the fill. |
Built with
Installs with Hold Button





