Skip to content

Hold Button

A button for an action you cannot take back: it only fires after a full press and hold. The fill sweeps with the clock, letting go early draws it back, and a finished hold runs the action and lands on a done state with a check.

On this page

Examples

Installation

npx knowns-ui@latest add hold-button
For Claude Code, Cursor or Codex: installs it and wires the props to your own data.

Props

children
ReactNode
The label, e.g. Hold to refund $240.00.
onCompleterequired
() => unknown
Runs after a full hold; the button is busy while a promise runs. Return false or throw to go back to the start.
duration
number
Default1200
How long to hold, ms.
doneLabel / busyLabel
ReactNode
The label once done (with a check), and while running (with a spinner). Without doneLabel it returns to the start after the action.
tone / size
"danger" | "primary" / "sm" | "md"
Default"danger" / "md"
Red for destructive actions, the accent otherwise; 32 or 36px high.
hint / describedBy
boolean / string
Defaulttrue / -
The hint under the button (Press and hold for 1.2 seconds...) that the button points aria-describedby at, or the id of your own.
Keyboard
-
Hold Space or Enter. Letting go, moving focus away or a cancelled pointer draws the fill back.
Motion
-
The fill follows the clock (linear); an early release draws it back in 180ms (ease out); done, the check pops (the motion lib's confirm). Reduced motion: the fill still shows progress, the rest is instant.

When to use

When to use

  • An agent action a person must confirm and cannot take back: a refund, a revoke, a deploy, a bulk delete.
  • A confirm that has to live in a row or a card, where a dialog would be too much.

When not to use

  • Everyday actions: a plain button is faster: use Button.
  • When the person must read terms before agreeing: use Dialog.

Using with AI

Use Copy page for AI above to give your assistant this page, Copy prompt under the install command to have it installed and wired to your data, or connect the Knowns UI MCP server and just ask:

  • Add the Knowns UI Hold Button to my app and wire it to my own data.
  • I need an agent action a person must confirm and cannot take back: a refund, a revoke, a deploy, a bulk delete. Set that up with the Knowns UI Hold Button.
  • Which Hold Button props do I need for a minimal setup? Show me a short example.

With the server connected, your assistant calls get_component({ name: "hold-button" }) and search_docs({ query: "hold button" }).

Need help?

Stuck on Hold Button, or found something off? We read every message.