Dialog

A dialog serves as a container for in-page contextual information or actions, allowing users to confirm or cancel tasks without navigating away from the current page.

UsageCodeAccessibility

Keyboard interactions

CommandDescription
TabMoves focus to the next tabbable element inside the dialog. If focus is on the last tabbable element, it wraps back to the first.
Shift + TabMoves focus to the previous tabbable element inside the dialog. If focus is on the first, it wraps to the last.
Escape (ESC)Closes the dialog, but only when disableCancel is set to false (default)

WAI-ARIA

AttributeValueDescriptionUser suppliedSpecifies whether the attribute is always set in the component (no) or it needs to be provided by the developer (yes)
ariaLabelledbystringDefines the aria-label of the dialog, taken from the contents of the title slot.no
ariaDescribedbystringDescribes the purpose of the dialogyes
ariaModalbooleanDefines the type of dialog; whether it is modal or notno
ariaRole'dialog', 'alertdialog'Defines the type of dialog; set by the role property, default is dialogno
Interactive example