---
agent:
  instructions: "Search goop.so for Goop's components, templates, design skill, docs, pricing and terms. Ask in keywords or a plain question, such as \"date picker props\" or \"is the design skill free\"; the answer is the matching page sections in Markdown, each with its address."
  endpoint: "https://goop.so/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://developers.cloudflare.com/ai-search/how-to/search-for-agents/"
---

# Destructive button

The button for an action that deletes or cannot be undone, marked in the danger colour, for React and Tailwind CSS. Part of Goop Pro.

Pro. Its export: `DestructiveButton`.

## Try it

Switch the shape, the size and the icon; change the words; disable it. Press it and the count goes up, never while disabled; in the pair, Cancel sets the count back. With Hold, hold it down to the end (or press it twice by a screen reader): the line under it says the delete was confirmed. Look puts it alone, on a card, or after Cancel.

Nothing is deleted: the press, or the finished hold, only counts. A real delete asks first (see the alert dialog).

## When to use

- The button for an action that deletes or cannot be undone, marked in the danger colour.

## When not to use

- Pair it with AlertDialog to confirm.

## Installation

Paste the prompt below into your coding agent. It reads Goop's install steps, installs the part and its tokens once, then reuses this same Destructive button on every screen instead of drawing a new one: the same height, the same focus ring, the same spacing. As a Pro part, its command comes from Goop's server once you sign in, with a one-time link that lasts ten minutes.

```sh
npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/trail-destructive-button.json --yes
```

```text
Add the Goop Destructive button to this project. The install steps are at https://goop.so/docs/install.md
```

## Usage

```tsx
import { DestructiveButton } from '@/components/ui/goop/destructive-button';

function DeleteNote({ onDelete }: { onDelete: () => void }) {
  return (
    <div className="flex gap-2">
      <DestructiveButton>Delete note</DestructiveButton>
      <DestructiveButton hold icon="trash" onConfirm={onDelete}>
        Delete note
      </DestructiveButton>
    </div>
  );
}
```

- Fits: schedule, settings (their recipes).
- Also known as: Button variant="destructive".
- height, width, corner, background, motion: add no class for these.

## API reference

### Options

- `icon?: IconName = 'alert-circle'` — A pack icon name, one whose shape says the action; left out, the circled bang the theme's destructive alert draws.
- `hold?: boolean = false` — Confirm by a press held down (the pointer, Space or Enter), with no dialog: a soft red fill runs across the button and `onConfirm` runs once it is full; released early, nothing runs.
- `onConfirm?: () => void` — With `hold`, the action: run once the hold reaches its end, or on the second step's press.
- `onFinished?: () => void` — With `hold`, run once the finish after `onConfirm` (the tick and `confirmedLabel`, a second) is over and the button is back at rest: close a panel round it there, so the finish is seen.
- `holdDuration?: number` — With `hold`, how long the press is held to confirm, ms (default 1200).
- `holdHint?: string = 'Hold to confirm'` — With `hold`, the button's description, said on a short press too.
- `confirmLabel?: string` — With `hold`, the words the button shows, and the status says, after a click with no press behind it (a screen reader's): a second press within four seconds confirms.
- `confirmedLabel?: string = 'Confirmed'` — With `hold`, the words the button shows, and the status says once, for a second after a hold held to the end, beside the pack's tick (default "Confirmed").
- `type?: 'button' | 'submit' | 'reset'`
- `onClick?: (event: MouseEvent) => void`
- `disabled?: boolean`

- Takes every prop of Button but variant and asChild (its page: button.md)

## Keyboard

- Enter: activate
- Space: activate

## Accessibility

- The part itself answers the keys above.
- hover, active, focus-visible: the browser's own (:hover, :active, :focus-visible): write nothing
- disabled: the prop disabled

## Motion

- The part sets its own motion: add no transition or animation of your own.

## Notes for AI

Give your coding agent this page as text instead of screenshots: the parts, the options, the states and the keys. An agent that reads the real part builds the real part, not a lookalike.

## Related

- [Alert dialog](/themes/trail/components/alert-dialog): A modal that asks a person to confirm or cancel before an action that cannot be undone, such as a delete.
- [Toggle button](/themes/trail/components/toggle-button): A button that stays pressed until it is pressed again.
- [Toggle group](/themes/trail/components/toggle-group): A row of toggle buttons that act together, one or several pressed, such as a view switch or text formatting.
- [Link](/themes/trail/components/link): A text link to another page or place, in running text or on its own.
