Alert Dialog
A modal dialog that interrupts the user with important content and expects a response.
Focus is automatically trapped
Can be controlled or uncontrolled
Esc closes the component automatically
Architecture
Reference
Alert Dialog
The root container that manages the state and behavior of the dialog system. Coordinates the interaction between trigger, content and optional backdrop components.
Attributes
- default-openboolean/default: false
The initial open state of the alert dialog when rendered. Use when you do not need to control its open state.
- openboolean/default: -
The controlled open state of the alert dialog. Must be used in combination with
onOpenChange.
Events
- onOpenChange
Event handler called when the open state of the alert dialog changes.
Content
The container that holds the alert dialog's content. Manages keyboard interactions and focus trapping.
Header
The container for the alert dialog's header section, containing the title and the close-button.
Description
The container for the alert dialog's descriptive content, providing additional context or details about the dialog's purpose.
Keyboard
- Space
Toggles the alert dialog open state.
- Enter
Toggles the alert dialog open state.
- Tab
Moves focus to the next focusable element. Focus is trapped within the alert dialog.
- Shift+Tab
Moves focus to the previous focusable element. Focus is trapped within the dialog.
- Escape
Closes the dialog and returns focus to the trigger element.