Dialog
Dialog base prototype
The dialog family provides the protocol-layer building blocks for modal and non-modal dialogs.
- dialog-root: Holds the
openstate and provides context to all child parts. - dialog-trigger: Opens or toggles the dialog on click.
- dialog-mask: Renders the backdrop mask and follows the open state for enter/leave transitions.
- dialog-content: Handles focus trapping, overlay dismissal strategies (ESC, outside press), and enter/leave transitions.
- dialog-title: Semantic title automatically linked to content via
aria-labelledby. - dialog-description: Semantic description automatically linked to content via
aria-describedby. - dialog-close: Closes the dialog on click.
Pass alert to dialog-content to turn it into an alert dialog: it sets role="alertdialog" and disables outside-press dismissal while keeping ESC close.