ConfirmDialog
Confirmation modal with async confirm, loading state, and danger variant.
Installation
Examples
Danger confirmation
Destructive action with red confirm button.
Delete account?
This will permanently delete your account and all data. This cannot be undone.
Default confirmation
Standard confirm with neutral styling.
Publish changes?
Your changes will be visible to all users immediately.
API Reference
| Prop | Type | Default | Description |
|---|---|---|---|
| open | boolean | — | Controlled open state. |
| onOpenChange | (v: boolean) => void | — | Called when state changes. |
| title | ReactNode | 'Are you sure?' | Dialog heading. |
| description | ReactNode | — | Explanation of the action. |
| confirmLabel | string | 'Confirm' | Confirm button label. |
| cancelLabel | string | 'Cancel' | Cancel button label. |
| variant | 'default'|'danger' | 'default' | danger applies destructive styling. |
| onConfirm | () => void | Promise<void> | — | Called when confirmed. Awaited if async. |
| loading | boolean | false | Shows spinner on confirm button. |