Delete Button React component for Tailwind CSS v4
v1.0.1Updated in 1.2.1
A React delete button with inline confirmation: the bin opens a small confirm and cancel panel in place, no dialog needed.
Click the bin to lift its lid open. A panel slides out with a check to confirm and a cross to back out. Escape, or the bin again, backs out too. Confirming draws a check where the bin was and swaps back to the bin after a moment; backing out settles the bin in place.
Delete Button is a free React component in the React button components category, written in TypeScript for React 19 and Tailwind CSS v4. It installs as source with npx wingo-ui@latest add delete-button, together with UIProvider and the npm package motion.
Add to a project
Requirements: React 19 and Tailwind CSS v4, in Next.js (App Router or Pages), Vite or React Router. Installation guide · Next.js setup · Vite setup
npx wingo-ui@latest add delete-buttonUsage
Import DeleteButton from @/components/ui/delete-button.
"use client"
import { DeleteButton } from "@/components/ui/delete-button"
export function Demo({ onDelete }: { onDelete: () => void }) {
return <DeleteButton label="Delete invoice" onConfirm={onDelete} />
}Props
sizedefault"md""sm" | "md" | "lg"Scale of the tile, the confirm panel and the icons. The tile is 40px (sm), 48px (md) or 56px (lg) square; on touch screens the sm tile and the confirm and cancel circles get a 44px tall hit area.
radiusdefault"md""none" | "sm" | "md" | "lg" | "full"Corner radius of the tile and the confirm panel: square, 6px tighter, the original 14 / 16 / 18px per size, 6px rounder, or a pill.
surfacedefault""stringAny CSS color for the tile and the two circles. Empty uses the soft gray (#F4F4F9 light, #262626 dark); hover lightens it.
recessdefault""stringAny CSS color for the confirm panel behind the circles. Empty uses #E7E7EF light, #1B1B1B dark.
iconColordefault""stringAny CSS color for the bin, the cross and the focus ring. Empty uses #868593 light, #9B9AA7 dark.
accentdefault"#FF5F2E"stringAny CSS color for the confirm check and the check drawn after deleting.
labeldefault"Delete"stringAccessible name of the bin button. Name the thing, e.g. "Delete invoice", when several sit on one screen.
confirmLabeldefault"Confirm delete"stringAccessible name of the check button in the panel.
cancelLabeldefault"Cancel"stringAccessible name of the cross button in the panel.
deletedLabeldefault"Deleted"stringAnnounced to screen readers after confirming.
keptLabeldefault"Kept"stringAnnounced to screen readers after backing out.
resetDelaydefault1400numberHow long the check stays after confirming, in milliseconds, before the bin comes back.
disableddefaultfalsebooleanBlocks the button and dims it. Disabling it while the panel is open backs out of the panel.
onConfirm() => voidCalled when the check is pressed.
onCancel() => voidCalled when the panel closes without deleting, from the cross, the bin, or Escape.
classNamestringExtra classes merged onto the root element; other div props are spread onto it too. The root carries data-state (open or closed) and data-status (idle, deleted or kept) for styling.
Examples
Remove team members
One small button per row with a label that names the person; confirming removes the row after the check shows.
Sizes
sm, md and lg. The panel and icons scale with the button.
Cart line item
radius full and a deeper red accent, next to the product photo and price.
Files
- components/ui/delete-button.tsx
FAQ
Is the React Delete Button component free?
Yes. The source is free and needs no account: copy it from the Code tab or install it with the CLI.
How do I install Delete Button?
Run npx wingo-ui@latest add delete-button. It also adds the Wingo UI item it builds on (UIProvider) and the npm package motion. With shadcn, run npx shadcn@latest add https://wingo-ui.com/r/delete-button.json.
See also
More React button components
Articles using this component
- React Slide to Confirm: When It Beats a Confirm Dialog
Mobile UI in React8 min read
- React Swipe to Delete: iOS Swipe Actions With Undo
Mobile UI in React9 min read