Menu icon
Three bars that fold into a close icon when their button opens a menu, and unfold when it closes: the top and bottom bars meet and turn 45 degrees, the middle one shrinks away. The button stays in place, so the same spot opens and closes.
Usage
Use it when
- The button that opens and closes site navigation on small screens: the top nav toggle, the app shell drawer toggle.
- Any button that opens a panel of navigation and also closes it from the same spot.
Use something else when
- A menu of actions on an item: use Dropdown menu. Use
more_horizormore_vert; it does not turn into a close icon. - Closing a dialog or sheet: use Icon button. A plain
closeicon. - Two icons for two states (play, pause): use Icon swap.
- Opening a section in the page: use Height expand.
Where it goes. The leading edge of a top bar on phones (app shell), or the trailing edge of a site header (top nav). Always inside an icon button that carries aria-expanded.
Examples
<div style="max-width: 360px;">
<div class="docs-row" style="justify-content: space-between;">
<span class="card__title">Campus</span>
<button class="icon-btn" aria-label="Menu" aria-expanded="false" aria-controls="mi-nav" onclick="const open = this.getAttribute('aria-expanded') !== 'true'; this.setAttribute('aria-expanded', String(open)); document.getElementById(this.getAttribute('aria-controls')).classList.toggle('is-closed', !open);"><span class="burger" aria-hidden="true"><i></i><i></i><i></i></span></button>
</div>
<div class="collapse is-closed" id="mi-nav"><div><nav class="list list--fill" aria-label="Main" style="margin-top: 8px;">
<a class="lrow" href="#" aria-current="page"><span class="lrow__body"><span class="lrow__title">Home</span></span></a>
<a class="lrow" href="#"><span class="lrow__body"><span class="lrow__title">Courses</span></span></a>
<a class="lrow" href="#"><span class="lrow__body"><span class="lrow__title">Schedule</span></span></a>
</nav></div></div>
</div>aria-expanded.<button class="btn btn--gray btn--md" aria-expanded="false" onclick="this.setAttribute('aria-expanded', String(this.getAttribute('aria-expanded') !== 'true'))"><span class="burger" aria-hidden="true"><i></i><i></i><i></i></span>Menu</button>Anatomy
| Part | What it is |
|---|---|
.burger | Required. 18 × 14 px, three <i> bars of 2 px. Must be a direct child of the element with aria-expanded. |
[aria-expanded="true"] > .burger | The folded state: bars 1 and 3 meet at the middle and rotate ±45 degrees; bar 2 fades and shrinks. |
Motion and microinteractions
- Bars 1 and 3:
topmoves to 6 px andtransformrotates ±45 degrees on--spring-snappy(--d-snappy, 360 ms), at the same time, so they cross in one motion. - Bar 2: fades over
--d-fastand shrinks toscaleX(0.2)on--spring-snappy. - It is driven only by
aria-expanded, so closing by Escape, a scrim tap or a followed link folds it back too, as long as the code updates the attribute (the app shell and top nav do). - Interruption: transitions, so a fast double press reverses mid-fold.
- Reduced motion: the bars change in 120 ms with no spring.
Accessibility
- The button has
aria-expanded,aria-controlsand a stablearia-label("Menu"); do not change the label to "Close" since the expanded state already says it. - Escape closes the menu and returns focus to this button.
- The bars are
aria-hidden.
Do and don't
Do
- Put
.burgerdirectly inside the button that hasaria-expanded. - Update
aria-expandedon every way the menu closes.
Don't
- Use it for item actions or for closing dialogs.
- Swap two icons instead of folding the bars.
- Move the button when the menu opens.
Behavior and code
Plain HTML. CSS only, driven by aria-expanded. data-lds-shell-toggle (app shell) and data-lds-topnav-toggle (top nav) keep aria-expanded in sync for you.