← All components
Specimen U-001 · icon

Burger

Three lines meet in the middle, then become a cross, arrow, minus, plus or a twisting cross. Closing plays it in reverse.

  • [ 0 deps ]No JavaScript and no packages. Just HTML and CSS you paste into your project.
  • state: aria-expandedYour code changes aria-expanded (or data-state) on the element; the CSS animates the change. That attribute is the only thing you wire up.
  • early releaseReady to use, but names of classes and settings may still change before version 1.0. Pin the version you copy.
  • all modern browsersUses only CSS that Chrome, Safari, Firefox and Edge have all supported for at least 2.5 years (Baseline widely available).
  • 0.93 kB · lightweightThe CSS is 948 bytes after gzip, which is how browsers download it. Lightweight is under 1 kB, moderate under 2.5 kB, heavy above.
Fig. 01 — 250 % · click to toggle
State
Variant
Line ends

Rounded ends and corners.

Colour Auto · follows the text colour
Preview background
<button class="u-burger" type="button" aria-expanded="false" aria-controls="menu" aria-label="Menu">
  <svg class="u-burger__svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" aria-hidden="true" focusable="false">
    <g class="u-burger__slide u-burger__slide--top"><line class="u-burger__line u-burger__line--top" x1="4" y1="6" x2="20" y2="6" /></g>
    <line class="u-burger__line u-burger__line--mid" x1="4" y1="12" x2="20" y2="12" />
    <g class="u-burger__slide u-burger__slide--bot"><line class="u-burger__line u-burger__line--bot" x1="4" y1="18" x2="20" y2="18" /></g>
    <polyline class="u-burger__head" points="10.34 5.66 4 12 10.34 18.34" />
  </svg>
</button>
Use it in your project

Three steps, no install.

  1. 01

    Add the CSS

    Copy the CSS tab into your stylesheet, or save it as burger.css and link it. It works on its own; our design tokens are optional.

  2. 02

    Paste the markup

    Copy the HTML tab where the burger should go. Your playground choices (variant, size, colour…) are already in it.

  3. 03

    Flip the state

    Set aria-expanded to "true" or "false" from your code. That's the whole wiring. Pick your framework below.

Accessibility

Use on a <button> with aria-label and aria-controls pointing at the menu. Toggle aria-expanded when the menu opens and closes.

Source

packages/core/src/components/burger