• 3

    Drawer

    A <dialog> variant that slides in from the edge of the screen instead of appearing centered. It's built entirely on top of the Dialog component, just add the drawer class.

    Default

    Add the drawer class to a <dialog>. By default it slides in from the right. Everything else, including .showModal(), closedby, and scroll-lock, works exactly like a regular dialog.

    This is a drawer. It slides in from the right edge.

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

    Position

    Use data-position to slide the drawer in from left, right, top, or bottom. It defaults to right when omitted.

    Slides in from the left.

    Slides in from the right.

    Slides in from the top.

    Slides in from the bottom.

    <dialog class="drawer" data-position="left">...</dialog>
    <dialog class="drawer" data-position="right">...</dialog>
    <dialog class="drawer" data-position="top">...</dialog>
    <dialog class="drawer" data-position="bottom">...</dialog>

    Use the card's <header> and <footer> to pin controls to the top and bottom of the drawer, same as inside a regular dialog.

    Filters

    Drawer content goes here.

    <dialog class="drawer" closedby="any">
      <article>
        <header>
          <strong>Filters</strong>
        </header>
        <p>Drawer content goes here.</p>
        <footer>
          <form method="dialog">
            <button>Apply</button>
            <button class="outlined">Cancel</button>
          </form>
        </footer>
      </article>
    </dialog>

    Search 5021 icons

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