Skip to content
Protocore Design Systemv1.6.9

/// Utilities

Burger

An animated hamburger↔close toggle — the mobile-nav trigger, reflecting its open state via aria-expanded.

import { Burger } from "@protocore/pds";
View as Markdown

Basics

A controlled toggle: hold the opened state yourself and update it from onToggle. The three lines morph into an X when opened; reduced-motion snaps between the two.

Driving a navigation drawer

The canonical use — a Burger that opens a Sheet of navigation on small screens. Its aria-expanded tracks the drawer, and its label flips between "Open" and "Close navigation".

Sizes

Three square sizes — sm 32 · md 36 · lg 40 — matching the control-height scale so it lines up with the buttons beside it in a top bar.

When to use it

Burger is the mobile-navigation trigger: a compact button that toggles a menu and animates to reflect whether that menu is open. It is purely a *trigger* — it owns no menu of its own. Wire opened/onToggle to the same state that drives your Sheet or Sidebar, so the icon and the drawer never disagree.

Keep it to genuinely responsive navigation. On wide layouts where the nav is always visible, don't show a Burger — there is nothing to reveal.

Usage

Do

  • Bind `opened` to the same state as the drawer it controls.
  • Update the `aria-label` to describe the *next* action ("Open" vs "Close navigation").
  • Match its `size` to the other controls in the bar.
  • Show it only at breakpoints where the navigation is collapsed.

Don't

  • Don't leave `aria-label` at a generic value that ignores the current state.
  • Don't animate it out of sync with the menu it toggles.
  • Don't use it as a generic icon button — it means "toggle navigation".
  • Don't show it when the full navigation is already on screen.

Accessibility

KeysAction
TabMoves focus to the toggle.
Enter / SpaceToggles it, firing onToggle with the next state.
  • Renders a real `<button>` exposing `aria-expanded` bound to `opened`, so assistive tech announces the collapsed/expanded state.
  • Requires an accessible name via `aria-label` (default "Open navigation") — the animated lines are `aria-hidden`.
  • The morph is pure CSS transform; `prefers-reduced-motion` snaps between hamburger and X with no tween.
  • The lines are `<span>` elements, not a text glyph, so nothing renders as an emoji.

Burger props

PropTypeDefaultDescription
aria-labelstringOpen navigationAccessible name for the control — required, since the icon carries no text.
classNamestring
onToggle((opened: boolean) => void)Called with the next opened state when the button is activated.
openedbooleanfalseWhether the burger is in its open (X) state. Controlled.
sizeenummdSquare control size: `sm` 32 · `md` 36 · `lg` 40.
styleCSSProperties

Related

  • CloseButtonA square, icon-only × dismiss control with a required aria-label — the shared close affordance for overlays.
  • SheetA full-height panel that slides in from the right for detail views and side forms that shouldn't cover the whole screen.
  • SidebarA left navigation rail of grouped items — mono uppercase group labels over sans links, with an accent rule on the active item.
  • AppShellThe application frame — an optional env strip and top bar over a sidebar + main body row, with an optional footer and a responsive mobile drawer.