Search for a command to run...
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.
Controlled usage (open derived from state, async confirm):
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.