• Dialog

    A native <dialog> element for popovers and modal overlays. Use an <article> inside for the card styling.

    Default

    Use .show() for non-modal dialogs that don't block interaction with the rest of the page. Close with <form method="dialog">.

    This is a non-modal dialog.

    <button onclick="document.getElementById('my-dialog').show()">
      Open dialog
    </button>
    
    <dialog id="my-dialog" closedby="any">
      <article>
        <p style="margin-bottom: 1rem">This is a non-modal dialog.</p>
        <form method="dialog">
          <button class="outline">Close</button>
        </form>
      </article>
    </dialog>

    Call .showModal() to open as a modal — it blocks interaction with the page and renders a backdrop.

    This is a modal dialog. It blocks the page behind it.

    <button onclick="document.getElementById('my-modal').showModal()">
      Open modal
    </button>
    
    <dialog id="my-modal" closedby="any">
      <article>
        <p>This is a modal dialog.</p>
        <form method="dialog">
          <button>Confirm</button>
          <button class="outline">Cancel</button>
        </form>
      </article>
    </dialog>

    Use the card's <header> and <footer> for a structured layout with dividers.

    Confirm action

    Are you sure you want to continue? This cannot be undone.

    <dialog id="my-modal" closedby="any">
      <article>
        <header>
          <strong>Confirm action</strong>
        </header>
        <p>Are you sure you want to continue?</p>
        <footer>
          <form method="dialog">
            <button class="destructive">Delete</button>
            <button class="outline">Cancel</button>
          </form>
        </footer>
      </article>
    </dialog>

    closedby

    The closedby attribute controls how a dialog can be dismissed.

    • closedby="any" — closes on outside click or Escape
    • closedby="closerequest" — closes on Escape only (default for modal)
    • closedby="none" — only closeable via <form method="dialog">

    This dialog can only be closed via the button.

    <dialog closedby="none">...</dialog>

    scroll-lock

    Add the scroll-lock attribute to prevent the page from scrolling while the dialog is open.

    Page scrolling is locked while this dialog is open.

    <dialog scroll-lock closedby="any">...</dialog>

    Search 5021 icons

    Type a name to find icons from the Tabler icon set.