Skip to content

Mega menu

A disclosure: a button with aria-expanded that shows a panel of headed link lists. Opening one menu closes the others, and the panel closes on Escape, on an outside click, or when focus leaves it. The panel spans the nearest positioned ancestor, which in a site header is the full header bar.

  • label: the trigger text (required). The panel id is made from it, so keep labels unique on a page
  • columns: list of { heading, links }, where links is a list of { label, href } (required)
  • promo slot: a column beside the links, up to 20rem wide, for a featured card or campaign
<MegaMenu
label="Library"
columns={[
{ heading: "Elements", links: [{ label: "Button", href: "/elements/button/" }, { label: "Image", href: "/elements/image/" }] },
{ heading: "Components", links: [{ label: "Card", href: "/components/card/" }, { label: "Drawer", href: "/components/drawer/" }] },
]}
/>
With a promo slot