Search for a command to run...
navigate
The one way to ask "are you sure?". An opinionated AlertDialog that fixes the confirm layout and button variants — so every confirm in the product reads and behaves the same.
import { ConfirmDialog } from "@delphi/ui/components/confirm-dialog";
import { Button } from "@delphi/ui/components/button";
export function Example() {
return (
<ConfirmDialog
trigger={<Button variant="destructive">Archive</Button>}
title="Archive conversation?"
description='This removes "Pricing questions" from your history.'
confirmLabel="Archive"
onConfirm={() => archive()}
/>
);
}Controlled usage (open derived from state, async confirm):
<ConfirmDialog
open={target != null}
onOpenChange={(next) => {
if (!next) setTarget(null);
}}
title={`Delete "${target?.name}"?`}
description="This removes it from your knowledge base. This action cannot be undone."
confirmLabel="Delete"
pending={isDeleting}
onConfirm={(event) => {
event.preventDefault();
deleteItem(target);
}}
/>ConfirmDialog| Prop | Type | Default | Description |
|---|---|---|---|
title | string | — | The question the user is answering. |
description | ReactNode | — | The consequence. State what happens and whether it can be undone. |
confirmLabel | string | — | Label for the primary action. |
cancelLabel | string | "Cancel" | Rarely overridden. |
destructive | boolean | true | false renders the action as the brand button instead of destructive. |
pending | boolean | false | Disables both buttons, swaps a spinner into the action, and blocks dismissal. |
onConfirm | (event) => void | — | Call event.preventDefault() to keep the dialog open through an async confirm, then close via onOpenChange. |
trigger | ReactNode | — | Rendered as the AlertDialogTrigger (asChild). Omit for controlled usage. |
open | boolean | — | Controlled open state. |
onOpenChange | (open: boolean) => void | — | Fires on open/close. Ignored for close attempts while pending. |
Reach for ConfirmDialog for every confirm — destructive or not. It exists so confirms stop
drifting; dropping to raw AlertDialog parts is for layouts this component genuinely can't
express.
Add body content between the description and the footer. A confirm is a question, a
consequence, and two buttons — if it needs a form, it isn't a confirm (use Dialog).
Confirm reversible actions. If the user can trivially undo it, skip the dialog and act — offer undo via toast where it matters.