Confirm dialog
One question and one answer, for an action worth stopping to confirm. Every label is a prop, so a refusal, an acceptance and a deletion are this component with different copy rather than three components.
Reach for it
Confirming a single action, especially a destructive one.
Not for
Anything with a form in it. That is a Dialog.
Confirming, and confirming destructively
isDestructive changes the emphasis of the confirm button. confirmText asks the user to type a value before the button enables, for the small number of actions where a misclick is expensive. isSubmitting keeps the dialog open and the button busy while the mutation runs.
Last confirmed: none
API reference
ConfirmDialog
| Prop | Type | Default | Description |
|---|---|---|---|
| isOpen* | boolean | - | |
| onOpenChange* | (open: boolean) => void | - | |
| title* | string | - | |
| confirmLabel* | string | - | |
| cancelLabel* | string | - | |
| closeLabel* | string | - | |
| onConfirm* | () => void | - | |
| data-testid | string | - | Names the element for a test. Never rendered, never announced. |
| description | ReactNode | - | The consequence of confirming, in the user's words. |
| isSubmitting | boolean | - | Disables both buttons and shows the confirm button busy. |
| isDestructive | boolean | - | Destructive actions focus Cancel first and use the danger intent. |
| confirmIntent | ButtonProps['intent'] | - | The confirm button's intent, when neither primary nor danger is right. An approval reads green on the trigger that opens this dialog, so the button that commits it reads green too. Without this the trigger was green and the confirmation brand blue, which is the same decision drawn two ways. Defaults to the destructive flag. |
| confirmText | string | - | Requires the user to type this exact string before confirming. From the DestructiveConfirmDialog, which is the one good idea none of the other two had: for something genuinely unrecoverable, a click is too cheap. Use it for deleting a mandate, not for cancelling a reminder. |
| confirmTextLabel | string | - | Label above the type-to-confirm field. Copy is the caller's. |
| children | ReactNode | - | Extra content between the description and the buttons. |