Dialog

Built on the native <dialog> element — the browser handles focus trap + ESC to close. Entry via @starting-style with a keyframe fallback.

Basic

Confirm action

Are you sure you want to continue?

<dialog class="dialog" id="d1">
  <div class="dialog__content">
    <header class="dialog__header">
      <h3 class="dialog__title">Title</h3>
      <button class="dialog__close">×</button>
    </header>
    <div class="dialog__body">Content</div>
    <footer class="dialog__footer">Actions</footer>
  </div>
</dialog>
<script>d1.showModal()</script>

Modifiers

ClassEffect
dialog.dialogBase — use the native element.
.dialog--small / --largeMax-width 20rem / 48rem.
.dialog--fullscreenCovers the viewport.
.dialog--no-header / --no-footerHide sub-regions.
.dialog--enhancedHeavier shadow + ring.
.dialog__header / __title / __body / __footer / __closeSub-elements.

Open with dialogEl.showModal() (traps focus) or dialogEl.show() (no backdrop). Close with dialogEl.close().