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 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
| Name | Default | Description |
|---|---|---|
onClose Required | (gesture: 'confirm' | 'close-button' | 'cancel' | 'escape') => voidThis callback is invoked when a gesture to close the dialog is performed. The first argument indicates the gesture. | |
title Required | React.ReactNodeThe title of the ConfirmationDialog. This is usually a brief question. | |
cancelButtonContent | Cancel | React.ReactNodeThe text to use for the cancel button. |
confirmButtonContent | OK | React.ReactNodeThe text to use for the confirm button. |
confirmButtonType | normal | 'normal' | 'primary' | 'danger'The type of button to use for the confirm button. |
className | stringAdditional 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 |