1. Reference
  2. Structure

<drawer>

A drawer that slides in from the left edge, opened by the menu icon or #id.open.

Structure

This tag has more than one name. Every spelling is the same tag, so write whichever feels natural. Pick one and every example on this page uses it.

drawer.ham
<screen>
    <app-bar title="Library"
             leading_icon="menu"/>
    <drawer id="nav">
        <drawer-header>
            <column style="p-16 gap-8">
                <avatar text="AR"
                        size="56"
                        color="teal"/>
                <text style="font-bold">Ana Ruiz</text>
            </column>
        </drawer-header>
        <list-tile icon="book">My loans</list-tile>
        <list-tile icon="settings">Settings</list-tile>
    </drawer>
    <main action-created="#nav.open">
        <column style="w-full p-16 gap-8">
            <text style="font-bold">Two books due this week</text>
            <button action="#nav.open">Open menu</button>
        </column>
    </main>
</screen>
The snippet drawn by Hype Apps on a phone, in light mode The snippet drawn by Hype Apps on a phone, in dark mode
This snippet as Hype Apps draws it on a phone. It follows this page's light or dark theme.

Attributes

NameWhat it doesDefault
bg-color Background color (theme-aware default)
color
mode Drawer mode: overlay (Material) or slide (Threads-style)
overlay, slide
overlay

Commands

NameWhat it does
close Close it.
open Open the drawer.
toggle Open/close.

Any tag also takes gestures: @on.tap, @on.longpress, @on.doubletap and @on.swipeleft (and right, up and down). @click runs on a tap too.

Guides and recipes that use it

This page is also Markdown, and all of HAM is in llms.txt.