Modal dialog component with header, body, footer structure and multiple sizes.
Structure
| Class | Description |
|---|---|
| .mdst-dialog | Container, applied to <dialog> element |
| .mdst-dialog__header | Header section with title and close button |
| .mdst-dialog__title | Dialog heading text |
| .mdst-dialog__close | Close button in header |
| .mdst-dialog__body | Main content area |
| .mdst-dialog__footer | Footer with action buttons |
Sizes
| Class | Example |
|---|---|
| .mdst-dialog | |
| .mdst-dialog--sm | |
| .mdst-dialog--lg | |
| .mdst-dialog--full |
Usage
<dialog id="my-dialog" class="mdst-dialog">
<div class="mdst-dialog__header">
<h2 class="mdst-dialog__title">Dialog Title</h2>
<button class="mdst-dialog__close" commandfor="my-dialog" command="close">✕</button>
</div>
<div class="mdst-dialog__body">
<p>Dialog content goes here.</p>
</div>
<div class="mdst-dialog__footer">
<button class="mdst-button mdst-button--borderless" commandfor="my-dialog" command="close">Cancel</button>
<button class="mdst-button mdst-button--solid" commandfor="my-dialog" command="close">Confirm</button>
</div>
</dialog>
<button commandfor="my-dialog" command="show-modal">Open Dialog</button>
<!-- Plain dialog inside .mdst-ui: no class and no parts, so it's padded
and its contents are spaced. Add a class to lay it out yourself. -->
<dialog id="note">
<p>Saved.</p>
<button commandfor="note" command="close">Close</button>
</dialog>