Skip to content

Modal

Standalone component with CDK Overlay/Portal/A11y, focus trap, backdrop, Escape, and focus return.

Design

Anatomy

1
1 Overlay (.ds-modal-overlay) — full-screen backdrop that blocks page interaction.
2 Container (.ds-modal) — elevated surface with border-radius and shadow.
3 Header (.ds-modal__header) — contains optional heading, description, and close button.
4 Title (.ds-modal__title) — linked via aria-labelledby.
5 Close button (.ds-modal__close) — dismisses the modal.
6 Body (.ds-modal__body) — scrollable content area.
7 Footer (.ds-modal__footer) — action buttons aligned right.

Interactive example · Angular

Running with the native Angular component and @angular/cdk/overlay + portal + a11y.

Loading functional preview…

Sizes · Angular

Three independent dialogs running through the Angular component with CDK Overlay.

Loading functional preview…

Custom body · Angular

Content projection with public Form Field, Input, and Buttons inside the Angular Overlay.

Loading functional preview…

Token mapping

PropertyTokenCSS variable
overlay backgroundcomponent.modal.overlay.bg.default--ds-modal-overlay-bg-default
surfacesemantic.surface.elevated--ds-surface-elevated
overlay paddingcomponent.modal.overlay.padding.default--ds-modal-overlay-padding-default
overlay z-indexcomponent.modal.overlay.z-index.default--ds-modal-overlay-z-index-default
border-radiuscomponent.modal.radius.default--ds-modal-radius-default
shadowcomponent.modal.shadow.default--ds-modal-shadow-default
max-widthcomponent.modal.max-width.{sm,md,lg}--ds-modal-max-width-*
header spacingcomponent.modal.header.{padding-*,gap}.*--ds-modal-header-*-*
body spacing/typographycomponent.modal.body.{padding-*,font-size,line-height,font-weight}.*--ds-modal-body-*-*
description typographycomponent.modal.body.{font-size,line-height,font-weight}.*--ds-modal-body-*-*
title typographycomponent.modal.title.{font-size,line-height,font-weight,letter-spacing}.*--ds-modal-title-*-*
footer spacingcomponent.modal.footer.{padding-*,gap}.*--ds-modal-footer-*-*
close targetcomponent.modal.close.size.{sm,md,lg}--ds-modal-close-size-*
close iconcomponent.modal.close.icon-size.{sm,md,lg}--ds-modal-close-icon-size-*
close paddingcomponent.modal.close.padding.{sm,md,lg}--ds-modal-close-padding-*