# Hold to confirm

A React component in [Beamline](https://beamline.io/)'s [Actions](https://beamline.io/components/actions) category, in the free sample. Live demo: https://beamline.io/components/hold-to-confirm

Confirms a costly action by holding instead of clicking: a fill sweeps across while held and drains if let go early; pointer, touch, Space and Enter all hold.

## Use it for

- Destructive actions where an accidental click is costly and a dialog would interrupt: delete a workspace, cancel an order.

## Not for

- Frequent actions (the hold becomes a tax).
- Actions people must be able to do without holding: pair it with another route where that matters ([alert-dialog](https://beamline.io/components/alert-dialog)).

## Anatomy

- button
- fill
- icon
- label
- hint for screen readers

## Variants

- **tone**: danger, neutral
- **size**: sm, md, lg

## States

- idle
- holding
- confirmed
- disabled

## Keyboard

- Hold Space or Enter
- releasing early cancels

## Motion

While held, a fill of the control's own colour (a quarter strength; ink at a seventh for neutral) sweeps from the inline start, linearly, for exactly the hold time, so its edge is the progress; let go early and it drains back over --pui-duration-standard. Confirmed keeps it full and the label slides to the result. Reduced motion keeps the sweep (it is information); the drain and label swap become instant.

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `label` | `string` | — |  |
| `confirmedLabel` | `string` | `"Done"` |  |
| `onConfirm` | `() => void` | — |  |
| `duration` | `number` | `1200` |  |
| `tone` | `"danger" \| "neutral"` | `"danger"` |  |
| `confirmed` | `boolean` | — |  |
| `onHoldChange` | `(holding: boolean) => void` | — |  |
| `style / ref` | `CSSProperties / native Ref` | — | native HTMLButtonElement |
| `classNames` | `HoldToConfirmClassNames` | — |  |

## Dependencies

`lucide-react`, `motion`

## Import

```tsx
import { HoldToConfirm } from "@/components/hold-to-confirm/hold-to-confirm";
```

## Get it

Hold to confirm is part of Beamline: 190 React components and screens your coding agent (Claude Code, Codex, Cursor or any MCP client) installs into your app through Beamline's MCP server, as a ready-built package or as plain React source you can change. $49 one payment (regular $200), no subscription, a year of updates, one licence for your whole team. Hold to confirm is in the free sample, which costs nothing. [Get Beamline](https://beamline.io/checkout?pack=complete) · [Connect your agent](https://beamline.io/connect)

## More in Actions

- [Button](https://beamline.io/components/button): The action control: five weights and a brand fill, a buy/sell tone, sm/md/lg and a 44 px touch size, icon-only, a loading state that keeps its size and…
- [Confirm morph](https://beamline.io/components/confirm-morph): A destructive action that asks in place: the button morphs into its question, then into working, then into the result with Undo or Retry, without a dialog.
- [Copy button](https://beamline.io/components/copy-button): Copies a value and confirms in place: the icon becomes a check and the label says Copied; a refused copy says so instead of pretending.
- [Split button](https://beamline.io/components/split-button): One obvious action joined to a menu of close alternatives; both halves are real buttons and the menu uses the shared menu rows.
- [Swipe actions](https://beamline.io/components/swipe-actions): Row actions behind a swipe on touch screens, mirrored in a menu at the row's end for pointer and keyboard; a full swipe runs the edge action.
- [Theme switch](https://beamline.io/components/theme-switch): The light/dark control: the page changes in one of four transitions starting from the button (reveal, eclipse, split, rise), and the icon turns between…
