ConfirmationDialog

ConfirmationDialog is a specialized dialog component used to confirm user actions. It provides a simple way to ask users to confirm or cancel potentially destructive or important actions.

Page navigation navigation

React
ready

React examples

Default

With custom button content

Danger confirmation

Different sizes

The ConfirmationDialog supports different width and height sizes to accommodate varying content lengths.

  • Small: Used for very brief confirmations with minimal content.
  • Medium (default): Suitable for most confirmation scenarios.
  • Large: For confirmations that require more detailed explanations.

Using the useConfirm hook

The useConfirm hook provides a convenient way to show confirmation dialogs imperatively without managing state manually.

More code examples

See the ConfirmationDialog Storybook stories

Props

ConfirmationDialog

NameDefaultDescription
onClose Required
(gesture: 'confirm' | 'close-button' | 'cancel' | 'escape') => void

This callback is invoked when a gesture to close the dialog is performed. The first argument indicates the gesture.

title Required
React.ReactNode

The title of the ConfirmationDialog. This is usually a brief question.

cancelButtonContent
Cancel
React.ReactNode

The text to use for the cancel button.

confirmButtonContent
OK
React.ReactNode

The text to use for the confirm button.

confirmButtonType
normal
'normal' | 'primary' | 'danger'

The type of button to use for the confirm button.

className
string

Additional class names to apply to the dialog.

width
medium
'small' | 'medium' | 'large' | 'xlarge'

The width of the dialog. small: 296px medium: 320px large: 480px xlarge: 640px

height
'small' | 'large' | 'auto'

The height of the dialog. small: 480px large: 640px auto: variable based on contents