How to build an accessible Menubar in React

Implements the WAI-ARIA menubar pattern: a roving-tabindex row of menuitem triggers (Left/Right/Home/End) where ArrowDown opens the menu and focuses its first item, Up/Down move within the menu, and Escape closes and restores focus to the trigger

When to use a Menubar

When not to use it

Keyboard interactions

Role menubar, verified at WCAG 2.2-AA.

Common mistakes

Avoid: Using Menubar entries as page links

Prefer: <NavigationMenu> for navigating between destinations

menubar implies commands/actions within the current view, not navigation to other pages

Example

<Menubar aria-label="Main" menus={[{ id: "file", label: "File", items: [{ id: "new", label: "New", onSelect: () => {} }] }]} />

See the full Menubar reference →