# Hold Button

> Confirm by holding, from a pointer or the keyboard.

For actions that deserve a moment: delete, publish, reset. Releasing early drains the progress, so nothing happens by accident and no dialog needs dismissing.

- Family: Buttons
- Plan: Creative. Included with Creative.
- Requires: React, Tailwind CSS v4 and the motion package
- Page with a live preview: https://galactrex.com/ui/hold-button/
- Licence: https://galactrex.com/ui/license/

## Install

```sh
npx @galactrex/ui login   # once, with an API key from https://galactrex.com/account/
npx @galactrex/ui add hold-button
```

It installs to `components/galactrex/hold-button.tsx`, with the shared motion helpers beside it. First time in a project: `npx @galactrex/ui init` (setup guide: https://galactrex.com/docs/ui-components-setup/).

## Usage

```tsx
import { HoldButton } from "@/components/galactrex/hold-button";

<HoldButton tone="danger" onConfirm={() => deleteProject(id)}>Delete project</HoldButton>
```

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `children` | `ReactNode` | — | What the button does. |
| `onConfirm` | `() => void` | — | Called once the hold completes. |
| `duration` | `number` | `1200` | Ms the button must be held. |
| `confirmedLabel` | `ReactNode` | `"Done"` | Label after confirming. |
| `resetAfter` | `number` | `1800` | Ms before it is ready again; 0 keeps it confirmed. |
| `tone` | `"default" \| "danger"` | `"default"` | Danger gives it a stronger border. |
| `disabled` | `boolean` | — | Disables the button. |
| `className` | `string` | — | Extra classes for the outer element. |

## Variants

- **Default.** Publish, send, ship.
- **Danger.** Delete or reset, with a stronger border.

## Accessibility

- Space or Enter held confirms from the keyboard; key repeat is ignored.
- A polite live region says when to keep holding and when it is confirmed.

## Motion

- Progress is a transform-only fill that drains back on early release.
- Reduced motion keeps the fill: it is information, not decoration.
