Dialog
Dialog provides a modal surface with headline, body, icon, and action slots built on the native <dialog> element.
Dialog actions use text buttons, including the primary, confirmation, final, and destructive actions. Express their hierarchy through clear labels, order, and position rather than filled, tonal, or outlined containers.
Anatomy
| Element | Part | Selector |
|---|---|---|
<dialog> | root | [data-scope="dialog"][data-part="root"]LMBCopy |
<div> | surface | [data-scope="dialog"][data-part="surface"]LMBCopy |
<div> | iconconditional | [data-scope="dialog"][data-part="icon"]LMBCopy |
<h2> | headlineconditional | [data-scope="dialog"][data-part="headline"]LMBCopy |
<div> | contentconditional | [data-scope="dialog"][data-part="content"]LMBCopy |
<div> | actionsconditional | [data-scope="dialog"][data-part="actions"]LMBCopy |
Props
| Name | Description | Default | Control |
|---|---|---|---|
closeOnBackdropOptional | Whether clicking the backdrop closes the dialog. boolean | undefined | true | |
widthOptional | Dialog surface width. Such as '28rem'. string | undefined | undefined | |
openOptional | - boolean | undefined | false |
Events3
| Name | Type | Description |
|---|---|---|
close | [returnValue: string] | - |
update:open | [value: boolean] | - |
cancel | [event: Event] | - |
Slots4
| Name | Parameters | Description |
|---|---|---|
icon | - | Optional leading icon content. |
headline | - | Optional dialog headline. |
default | - | Supporting text or custom body content. |
actions | - | Action buttons row. |
Styling26
| Token | Description |
|---|---|
--md-dialog-action-label-text-colorColorFallback var(--md-sys-color-primary) | Controls action label text color. |
--md-dialog-action-label-text-fontTypographyFallback var(--md-sys-typescale-label-large-font) | Controls action label text font. |
--md-dialog-action-label-text-line-heightTypographyFallback var(--md-sys-typescale-label-large-line-height) | Controls action label text line height. |
--md-dialog-action-label-text-sizeLayoutFallback var(--md-sys-typescale-label-large-size) | Controls action label text size. |
--md-dialog-action-label-text-trackingTypographyFallback var(--md-sys-typescale-label-large-tracking) | Controls action label text tracking. |
--md-dialog-action-label-text-typeTypographyFallback var(--md-sys-typescale-label-large) | Controls action label text type. |
--md-dialog-action-label-text-weightTypographyFallback var(--md-sys-typescale-label-large-weight) | Controls action label text weight. |
--md-dialog-container-colorColorFallback var(--md-sys-color-surface-container-high) | Controls container color. |
--md-dialog-container-elevationElevationFallback var(--md-sys-elevation-level3) | Controls container elevation. |
--md-dialog-container-shapeShapeFallback var(--md-shape-overlay) | Controls container shape. |
--md-dialog-headline-colorColorFallback var(--md-sys-color-on-surface) | Controls headline color. |
--md-dialog-headline-fontTypographyFallback var(--md-sys-typescale-headline-small-font) | Controls headline font. |
--md-dialog-headline-line-heightTypographyFallback var(--md-sys-typescale-headline-small-line-height) | Controls headline line height. |
--md-dialog-headline-sizeLayoutFallback var(--md-sys-typescale-headline-small-size) | Controls headline size. |
--md-dialog-headline-trackingTypographyFallback var(--md-sys-typescale-headline-small-tracking) | Controls headline tracking. |
--md-dialog-headline-typeTypographyFallback var(--md-sys-typescale-headline-small) | Controls headline type. |
--md-dialog-headline-weightTypographyFallback var(--md-sys-typescale-headline-small-weight) | Controls headline weight. |
--md-dialog-supporting-text-colorColorFallback var(--md-sys-color-on-surface-variant) | Controls supporting text color. |
--md-dialog-supporting-text-fontTypographyFallback var(--md-sys-typescale-body-medium-font) | Controls supporting text font. |
--md-dialog-supporting-text-line-heightTypographyFallback var(--md-sys-typescale-body-medium-line-height) | Controls supporting text line height. |
--md-dialog-supporting-text-sizeLayoutFallback var(--md-sys-typescale-body-medium-size) | Controls supporting text size. |
--md-dialog-supporting-text-trackingTypographyFallback var(--md-sys-typescale-body-medium-tracking) | Controls supporting text tracking. |
--md-dialog-supporting-text-typeTypographyFallback var(--md-sys-typescale-body-medium) | Controls supporting text type. |
--md-dialog-supporting-text-weightTypographyFallback var(--md-sys-typescale-body-medium-weight) | Controls supporting text weight. |
--md-dialog-with-icon-icon-colorColorFallback var(--md-sys-color-secondary) | Controls with icon icon color. |
--md-dialog-with-icon-icon-sizeLayoutFallback 1.5rem | Controls with icon icon size. |
Width
Use the width prop for the dialog surface width.
<Dialog width="28rem" />For stylesheet-level customization, set --md-dialog-container-width on the Dialog root. The root native <dialog> remains fullscreen so backdrop clicks and modal positioning keep working, while the token controls the inner surface.
<Dialog class="wide-dialog" />.wide-dialog {
--md-dialog-container-width: 40rem;
}Scrollable content
The content part preserves common descendant visual overflow at its block edges while remaining independently scrollable. See Scrollable Content Visual Overflow for the shared Dialog and sheet contract and its customization token.