Search

Search the site

All components

Confirm Button

Button wrapper that asks for confirmation before executing actions.

Default
Destructive confirmation flow for delete actions.

Items remaining: 3

1"use client";
2
3import { useState } from "react";
4import { ConfirmButton } from "@/registry/ui";
5
6export function ConfirmButtonDefaultExample() {
7 const [count, setCount] = useState(3);
8
9 return (
10 <div className="flex flex-col items-center gap-3">
11 <p className="text-sm text-muted-foreground">Items remaining: {count}</p>
12 <ConfirmButton
13 label="Delete item"
14 onConfirm={() => setCount((prev) => Math.max(0, prev - 1))}
15 />
16 </div>
17 );
18}
Soft Action
Non-destructive confirmation style for archive workflows.
1"use client";
2
3import { ConfirmButton } from "@/registry/ui";
4
5export function ConfirmButtonSoftExample() {
6 return (
7 <div className="flex justify-center">
8 <ConfirmButton
9 label="Archive"
10 variant="outline"
11 title="Archive this conversation?"
12 description="You can restore it later from archived items."
13 confirmLabel="Archive"
14 onConfirm={() => Promise.resolve()}
15 />
16 </div>
17 );
18}

Installation & source

Install via the shadcn CLI or copy the registry files manually.

bash
npx shadcn@latest add @tt-ui/confirm-button

Props

NameTypeDefaultDescription
onConfirm() => void | Promise<void>RequiredCallback executed after confirming the action
labelstring"Delete"Text shown on the trigger button
descriptionstring"This action cannot be undone."Confirmation helper copy shown inside the popover