App navigation
Hamburger menu
Menu hamburger
Demo
Loading demo…
A three-line button that opens the main navigation, hidden by default. It frees up space on small screens, at the cost of navigation that is easier to miss.
Story
Did you know
Norm Cox drew the icon for the Xerox Star in 1981, as a tiny picture of a list. It slept for thirty years before taking off with responsive design and the first iPhone apps.
Timeline
- 1981Norm Cox draws the icon for the Xerox Star.
- 2009+iPhone apps (Path, Facebook) adopt it for side drawers.
- 2012+Responsive design makes it everywhere on the mobile web.
- 2014+Backlash: many apps go back to a visible tab bar.
Vocabulary
Names
- FR
- Menu hamburger, menu burger, menu à trois barres, tiroir de navigation
- EN
- Hamburger menu, nav drawer, navigation drawer, off-canvas menu, side drawer, hamburger icon
Common uses
- Main navigation on mobile
- Secondary menus people rarely open
- Apps with many sections
Often paired with
The components it usually sits with, by page type, in reading order.
Blog post
See the mock-upSocial feed
See the mock-upCode
<button id="menu-btn" aria-label="Menu" aria-controls="menu" aria-expanded="false">
<svg aria-hidden="true" width="24" height="24" viewBox="0 0 24 24">
<path d="M3 6h18M3 12h18M3 18h18" stroke="currentColor" stroke-width="2" />
</svg>
</button>
<nav id="menu" aria-label="Main" hidden>
<a href="/">Home</a>
<a href="/projects">Projects</a>
<a href="/settings">Settings</a>
</nav>
<script>
const btn = document.getElementById('menu-btn')
const menu = document.getElementById('menu')
function setOpen(open) {
btn.setAttribute('aria-expanded', open)
menu.hidden = !open
}
btn.addEventListener('click', () => setOpen(menu.hidden))
document.addEventListener('keydown', (e) => {
if (e.key !== 'Escape' || menu.hidden) return
setOpen(false)
btn.focus()
})
</script>Good to know
aria-expandedon the button doubles as a CSS hook:[aria-expanded="true"]turns the icon into a cross.- Native options: the
popoverattribute withpopovertargetgives you the top layer, Escape and click-outside dismissal with no JS. For a full-screen drawer, use<dialog>+showModal(). - A scrolling drawer scrolls the page behind it once it hits the end: put
overscroll-behavior: containon the drawer. - On desktop, testing shows visible navigation gets used more than navigation hidden behind the icon.
Accessibility
Must have
- A real
<button>with anaria-label: the icon alone has no accessible name (WCAG 4.1.2). - The button exposes its state with
aria-expandedand points to the menu witharia-controls. - Escape closes the menu and sends focus back to the button.
Often forgotten
- A drawer moved off-screen with
transformis still reachable with Tab. Addhidden,inertorvisibility: hiddenwhen it is closed. - Keep the label fixed ("Menu"):
aria-expandedalready announces open or closed. Changing the label as well says it twice. - A target of at least 24 × 24 px (WCAG 2.5.8), 44 × 44 px to do it properly.
Nice to have
- Write "Menu" next to the icon: not everyone recognises the three lines.
- If the drawer covers the page, a modal
<dialog>keeps focus inside and makes the rest inert.