Skip to Content

Confirm Dialog

The ConfirmDialog component is a dialog that prompts the user to confirm an action. It is a wrapper around the Dialog component that provides a simple API for creating confirmation dialogs.

Examples

Default

API

NameTypeDefault
openboolean

Whether the dialog is open or not

contentReactNode

The content of the dialog

confirmLabelstring

The label for the confirm button

'Confirm'
cancelLabelstring

The label for the cancel button

'Cancel'
onConfirm() => void | Promise<void>

Callback when the confirm button is clicked. May return a Promise; while it is pending the dialog shows a loading state and disables its action buttons.

onCancel() => void

Callback when the cancel button is clicked

variant"default" | "destructive"

The visual variant of the dialog. Use destructive for actions like delete.

'default'
loadingboolean

Controlled loading state for the confirm action. When provided, takes precedence over the dialog’s internal async tracking — use this when the loading state lives outside the dialog (e.g. driven by a mutation hook). When omitted, the dialog automatically enters the loading state if onConfirm returns a Promise.

confirmDisabledboolean

Whether the confirm button is disabled.

childrenReactElement<ConfirmDialogActionsProps, string | JSXElementConstructor<any>>

Optional slot children. Pass a <ConfirmDialogActions> element to replace the default Confirm/Cancel buttons. Action children can read the managed state via useConfirmDialogContext(). Other React nodes are not rendered — use header/content props for those.

Last updated on