Skip to content

Hold Button

Free

A button that runs its action only after you press and hold it. The fill grows while you hold and drains back if you let go early.

  • Base UI
  • Motion
  • React 19
  • Tailwind CSS 4

Added Nov 12, 2026 · MIT + Commons Clause

Playground

Loading the preview

Props

Put the action in onConfirm: it runs only after a full hold.

delete-project.tsx

HoldButton

<div>
PropTypeDefaultDescription
classNamestring—
busyboolean—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"
durationnumber—A full hold in ms. Default 1500; at least 200.
onHoldStart—A press started to fill.
onHoldCancel—A press ended before the end: the fill drains.
onConfirm—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.
defaultStatus"done""error""idle""pending"—The status at first (uncontrolled).
onStatusChange—
resetAfternumber—Back to idle this many ms after done (an action that can run again).
actionsRef—Confirm or reset from code.
hapticsboolean—A 10ms vibration when the hold completes, where the browser has one (Android). Default true.
childrenConfirmContent—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.
statusText—The words of pending, done, and error. Defaults (English): "Confirming", "Confirmed", "Retry".
glowboolean—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.
  • Use it for a delete, a send, or a swap that needs a clear, slow gesture.
  • Return a promise from onConfirm to show pending, then done or error.
  • Set duration near 600ms for an action you can undo and near 2000ms for one you cannot.
  • For a normal action that is easy to undo, use a Button.
  • For a gesture people drag along a track, use Swipe to Confirm.
  • For an action that needs a written reason or a second look, use an Alert Dialog.
SpaceorEnterHold: fills while held; a full hold runs the action. Let go early and the fill drains.
EscapeWhile held: stops the hold and drains the fill.
Hold
progress · the fill grows from the start side at one speed for `duration`
Let go early
indicator · the fill drains back from where it is
Reset or error
sheet · the full fill drains back to empty
Click with no hold
sheet · the fill runs in to full, then the action runs
Status text
fade · the label fades to the text of the new status

Built with

Installs with Hold Button

Components
Button,Spinner
  1. AddedHold Button, with Button, Spinner.
Open the release