Installation
Usage
Basic Example
Composed Anatomy
For advanced use cases, you can compose the dialog using individual parts:Without Close Button
API Reference
Dialog (Root)
The initial open state when uncontrolled.
The controlled open state of the dialog.
Callback fired when the open state changes.
Dialog.Content
Whether to display the close button in the top-right corner.
Additional CSS classes to apply to the dialog popup.
Dialog.Trigger
The element to render as the trigger. Uses Base UI render composition.
Dialog.Title
The title content for the dialog.
Dialog.Description
The description content for the dialog.
Dialog.Header
The header content, typically contains Title and Description.
Dialog.Footer
The footer content, typically contains action buttons.
Whether to include a close button in the footer.
Dialog.Close
The element to render as the close trigger.
Component Parts
The Dialog component is built from several composable parts:Dialog- Root component that manages stateDialog.Trigger- Opens the dialogDialog.Portal- Portals the dialog content to document.bodyDialog.Backdrop- The overlay backdropDialog.Viewport- Centers the dialog popupDialog.Popup- The dialog containerDialog.Content- Convenience wrapper that includes Portal, Backdrop, Viewport, and PopupDialog.Header- Styled header containerDialog.Title- Accessible titleDialog.Description- Accessible descriptionDialog.Footer- Styled footer containerDialog.Close- Closes the dialogDialog.Overlay- Alternative backdrop component
Accessibility
- Dialog implements the WAI-ARIA Dialog pattern
- Focus is trapped within the dialog when open
- Pressing Escape closes the dialog
- Focus returns to the trigger element when closed
- Title and Description are automatically linked for screen readers