---
title: "Delete Button"
description: "A bin button that opens into a cross and a tick to confirm, then a spinner while it deletes, then a drawn check with Deleted."
category: "Micro Interactions"
publishedAt: "2026-11-16"
updatedAt: "2026-11-25"
documentation: "https://beui.dev/micro-interactions/delete-button"
markdown: "https://beui.dev/micro-interactions/delete-button.md"
license: "MIT"
---

# Delete Button

> A bin button that opens into a cross and a tick to confirm, then a spinner while it deletes, then a drawn check with Deleted.

## Install

```bash
npx shadcn@latest add @beui/delete-button
```

## Dependencies

- `clsx`
- `lucide-react`
- `motion`
- `react`
- `tailwind-merge`

## Usage

```tsx
"use client";

import { DeleteButton } from "@/components/motion/delete-button";

export function DeleteButtonUsage() {
  return (
    <DeleteButton
      onDelete={async () => {
        // Replace with your own request; Deleting shows until it settles.
        await new Promise((resolve) => setTimeout(resolve, 800));
      }}
    />
  );
}
```

## API Reference

### DeleteButton

| Prop | Type | Default | Required | Description |
| --- | --- | --- | --- | --- |
| `onDelete` | `(() => unknown)` | — | No | Runs when the delete is confirmed. Return a promise to keep the spinner up until it settles; if it rejects, the button goes back to the bin. |
| `disabled` | `boolean` | `false` | No | Disable the bin button and dim the control. Default: false |
| `labels` | `Partial<{ delete: string; confirm: string; cancel: string; deleting: string; deleted: string; }>` | — | No | Override any built-in string, e.g. for translation. |
| `sound` | `boolean` | `false` | No | Play a tap to arm, a close on cancel and a crumple once deleted. Off by default; a `SoundProvider` can mute it app-wide. |
| `className` | `string` | — | No | Classes merged onto the root element. |

## About Delete Button

Delete Button is a delete with confirmation for React built with Framer Motion. It starts as a round bin button. Pressing it opens the pill into a cross and a red tick that spring out from the centre. The tick turns it into a spinner while the delete runs, then into a check that draws itself beside Deleted, before the bin comes back. The cross cancels. One pill springs to the width of each step, so the whole exchange happens in place.

### When to use it

- A list row, file or comment needs a delete that a stray click cannot trigger.
- A settings page removes an API key, a member or a saved card.
- A table action deletes in place without opening a dialog.

### Accessibility

Every step is a real button with its own name: Delete, then Cancel and Confirm delete. Opening the pair moves focus to Cancel, the safe choice, so Enter never deletes by accident. Escape or moving focus away cancels. The spinner is a status named Deleting and the result a status reading Deleted. With reduced motion the steps crossfade without scaling or sliding.

### FAQ

**How do I run the delete?**

Pass onDelete. It runs when the tick is pressed; return a promise to keep the spinner up until the work finishes. If the promise rejects, the button goes back to the bin.

**Can I rename the steps?**

Yes. Pass labels with delete, confirm, cancel, deleting and deleted, or provide them through LocaleProvider.

## Source

- Registry detail: https://beui.dev/r/delete-button
- Raw source: https://beui.dev/r/delete-button/raw
- GitHub: https://github.com/starc007/ui-components
