Skip to content

Modal Component

A modal dialog component.

Properties

NameTypeDefaultDescription
openbooleanfalseIndicates whether the modal is open.
titlestring''Sets the title of the modal. If not provided, no title is displayed.
descriptionstring''Provides a description or content text for the modal. If empty, no description is shown.
alignmentstring'right'Determines the alignment of the modal's content. Can be 'right', or 'center'.
imagestringundefinedURL of an image to display within the modal. If specified, the image is shown above the content, if not pass the icon slot.

Slots

NameDescription
iconthe icon slot of the modal dialog.
actionsthe actions slot of the modal dialog.

CSS Parts

NameDescription
overlayThe overlay background when the modal is open.
dialogThe main container for the modal dialog.
image-containerThe container of the image element, a div.
imageThe image element, a img.
iconThe container of the icon slot, a div.
contentThe wrapper around title and description, a div.
titleThe title element, a span.
descriptionThe description element, a p.
actionsThe container of the actions slot, a div.

Check this link to learn how to use CSS parts for Modal Component.

CSS Properties

TokenDefaultDescription
--tap-dialog-color-surface-overlay--tap-sys-color-surface-overlay-darkThe background color of the overlay.
--tap-dialog-color-surface-primary--tap-sys-color-surface-primaryThe background color of the modal dialog.
--tap-dialog-radius--tap-sys-radius-6The border radius of the modal dialog.
--tap-dialog-icon-top-margin--tap-sys-spacing-8The top margin of the icon.
--tap-dialog-image-container-background-color--tap-palette-gray-100The background color of the image container.
--tap-dialog-content-vertical-padding--tap-sys-spacing-4The vertical padding of the content.
--tap-dialog-content-horizontal-padding--tap-sys-spacing-6The horizontal padding of the content.
--tap-dialog-content-vertical-margin--tap-sys-spacing-6The vertical margin of the content.
--tap-dialog-content-horizontal-margin-The horizontal margin of the content.
--tap-dialog-title-font-size--tap-sys-typography-headline-sm-sizeThe font size of the title in the dialog modal.
--tap-dialog-title-font-weight--tap-sys-typography-headline-sm-weightThe font weight of title in the dialog modal.
--tap-dialog-title-line-height--tap-sys-typography-headline-sm-heightThe line height of title in the dialog modal.
--tap-dialog-description-margin-The margin of the description in the dialog modal.
--tap-dialog-description-padding-top--tap-sys-spacing-4The top padding of the description in the dialog modal.
--tap-dialog-description-font-size--tap-sys-typography-body-md-sizeThe font size of the description in the dialog modal.
--tap-dialog-description-font-weight--tap-sys-typography-body-md-weightThe font weight of the description in the dialog modal.
--tap-dialog-description-line-height--tap-sys-typography-body-md-heightThe line height of the description in the dialog modal.
--tap-dialog-description-color--tap-palette-gray-500The color of the description in the dialog modal.
--tap-dialog-actions-padding--tap-sys-spacing-6The padding of the actions in the dialog modal.