Dialog
A window placed on the top of the primary window or another dialog window. It renders the content underneath inert. Implements the ARIA dialog pattern for proper accessibility support.
Supports modal and non-modal modes
Focus is automatically trapped when modal
Can be controlled or uncontrolled
Esc closes the component automatically
Architecture
Reference
-
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.
- modalboolean/default: false
When
true
, interaction with elements outside the dialog will be disabled and only dialog content will be visible to screen readers. - 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 dialog's content. Manages keyboard interactions and focus trapping.
-
Header
The container for the dialog's header section, containing the title and the close-button.
-
Description
The container for the dialog's descriptive content, providing additional context or details about the dialog's purpose.
Keyboard
- Space
Toggles the dialog open state.
- Enter
Toggles the dialog open state.
- Tab
Moves focus to the next focusable element. When modal, focus is trapped within the dialog.
- Shift+Tab
Moves focus to the previous focusable element. When modal, focus is trapped within the dialog.
- Escape
Closes the dialog and returns focus to the trigger element.