Skip to content
Browse docs and components

Hold Button

hold-button

Press and hold to confirm, with a fill that sweeps across while you hold and drains back if you let go early. For actions too serious for one click and too small for a dialog. Space and Enter hold it from the keyboard.

Responsive

Install

$npxshadcnadd@forme/hold-button

Adds the component, its registry dependencies, and the token stylesheet you import once.

Usage

import { HoldButton } from "@/components/forme/hold-button/hold-button";

<HoldButton onConfirm={revokeKey} doneLabel="Revoked">
  Hold to revoke
</HoldButton>

When to use

Reach for it

  • Actions too serious for one click and too small for a dialog: revoking a key, ending a call for everyone.

Use something else

  • Anything a person does often; holding for over a second every time gets old fast.
  • Irreversible actions at scale, which deserve a dialog that asks for the name.

API reference

Read from the source, so it is the API of the file you install. A prop marked * is required.

HoldButton

Press and hold to confirm. The fill sweeps across while the press lasts; let go early and it drains back.

PropTypeDefaultDescription
children*ReactNode—
onConfirm*() => void—
durationnumber1200Milliseconds the press must be held.
doneLabelReactNode"Done"Label shown once confirmed, before it resets.
variant"danger" | "primary""danger"
disabledboolean—
classNamestring—

Accessibility

  • Space and Enter hold it from the keyboard, and the instruction to hold is in its accessible description.

Motion

  • A fill sweeps across for duration, 1200ms by default, and drains back if you let go early.