GitHubopen_in_new

Dialog

Dialog provides a modal surface with headline, body, icon, and action slots built on the native <dialog> element.

Delete file?

The file will be permanently removed from your workspace.

Anatomy

ElementPartSelector
<dialog>
root
[data-scope="dialog"][data-part="root"]
left_clickLMBCopy
<div>
surface
[data-scope="dialog"][data-part="surface"]
left_clickLMBCopy
<div>
iconconditional
[data-scope="dialog"][data-part="icon"]
left_clickLMBCopy
<h2>
headlineconditional
[data-scope="dialog"][data-part="headline"]
left_clickLMBCopy
<div>
contentconditional
[data-scope="dialog"][data-part="content"]
left_clickLMBCopy
<div>
actionsconditional
[data-scope="dialog"][data-part="actions"]
left_clickLMBCopy

Props

NameDescriptionDefaultControl
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

NameTypeDescription
close[returnValue: string]-
update:open[value: boolean]-
cancel[event: Event]-

Slots4

NameParametersDescription
icon-Optional leading icon content.
headline-Optional dialog headline.
default-Supporting text or custom body content.
actions-Action buttons row.

Styling26

TokenDescription
--md-dialog-action-label-text-colorColor
Fallbackvar(--md-sys-color-primary)

Controls action label text color.

--md-dialog-action-label-text-fontTypography
Fallbackvar(--md-sys-typescale-label-large-font)

Controls action label text font.

--md-dialog-action-label-text-line-heightTypography
Fallbackvar(--md-sys-typescale-label-large-line-height)

Controls action label text line height.

--md-dialog-action-label-text-sizeLayout
Fallbackvar(--md-sys-typescale-label-large-size)

Controls action label text size.

--md-dialog-action-label-text-trackingTypography
Fallbackvar(--md-sys-typescale-label-large-tracking)

Controls action label text tracking.

--md-dialog-action-label-text-typeTypography
Fallbackvar(--md-sys-typescale-label-large)

Controls action label text type.

--md-dialog-action-label-text-weightTypography
Fallbackvar(--md-sys-typescale-label-large-weight)

Controls action label text weight.

--md-dialog-container-colorColor
Fallbackvar(--md-sys-color-surface-container-high)

Controls container color.

--md-dialog-container-elevationElevation
Fallbackvar(--md-sys-elevation-level3)

Controls container elevation.

--md-dialog-container-shapeShape
Fallbackvar(--md-shape-overlay)

Controls container shape.

--md-dialog-headline-colorColor
Fallbackvar(--md-sys-color-on-surface)

Controls headline color.

--md-dialog-headline-fontTypography
Fallbackvar(--md-sys-typescale-headline-small-font)

Controls headline font.

--md-dialog-headline-line-heightTypography
Fallbackvar(--md-sys-typescale-headline-small-line-height)

Controls headline line height.

--md-dialog-headline-sizeLayout
Fallbackvar(--md-sys-typescale-headline-small-size)

Controls headline size.

--md-dialog-headline-trackingTypography
Fallbackvar(--md-sys-typescale-headline-small-tracking)

Controls headline tracking.

--md-dialog-headline-typeTypography
Fallbackvar(--md-sys-typescale-headline-small)

Controls headline type.

--md-dialog-headline-weightTypography
Fallbackvar(--md-sys-typescale-headline-small-weight)

Controls headline weight.

--md-dialog-supporting-text-colorColor
Fallbackvar(--md-sys-color-on-surface-variant)

Controls supporting text color.

--md-dialog-supporting-text-fontTypography
Fallbackvar(--md-sys-typescale-body-medium-font)

Controls supporting text font.

--md-dialog-supporting-text-line-heightTypography
Fallbackvar(--md-sys-typescale-body-medium-line-height)

Controls supporting text line height.

--md-dialog-supporting-text-sizeLayout
Fallbackvar(--md-sys-typescale-body-medium-size)

Controls supporting text size.

--md-dialog-supporting-text-trackingTypography
Fallbackvar(--md-sys-typescale-body-medium-tracking)

Controls supporting text tracking.

--md-dialog-supporting-text-typeTypography
Fallbackvar(--md-sys-typescale-body-medium)

Controls supporting text type.

--md-dialog-supporting-text-weightTypography
Fallbackvar(--md-sys-typescale-body-medium-weight)

Controls supporting text weight.

--md-dialog-with-icon-icon-colorColor
Fallbackvar(--md-sys-color-secondary)

Controls with icon icon color.

--md-dialog-with-icon-icon-sizeLayout
Fallback1.5rem

Controls with icon icon size.

Width

Use the width prop for the dialog surface width.

vue
<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.

vue
<Dialog class="wide-dialog" />
css
.wide-dialog {
  --md-dialog-container-width: 40rem;
}

Examples

Default

Delete file?

The file will be permanently removed from your workspace.

With Icon

info

Sync paused

Changes are saved locally and will upload automatically when the network is available again.