Delete Button

A bin that asks to confirm, spins while deleting, then checks off.

Preview

"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));
      }}
    />
  );
}

Install

Add it with the shadcn CLI, or copy the source manually.

$ bunx --bun shadcn add @beui/delete-button

API Reference

onDelete?
(() => unknown)

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.

Default—
disabled?
boolean

Disable the bin button and dim the control. Default: false

Defaultfalse
labels?
Partial<{ delete: string; confirm: string; cancel: string; deleting: string; deleted: string; }>

Override any built-in string, e.g. for translation.

Default—
sound?
boolean

Play a tap to arm, a close on cancel and a crumple once deleted. Off by default; a `SoundProvider` can mute it app-wide.

Defaultfalse
className?
string

Classes merged onto the root element.

Default—

Updated