Navigation Menu

An accessible navigation menu with rich content panels, nested submenus, and keyboard support.

Features

  • Rich content panels
  • Nested submenus
  • Pointer and keyboard opening
  • Managed focus
  • Composable links

Installation

npm install @ariaui/navigation-menu

Examples

Top-level triggers open rich content panels and nested submenus—built for primary site navigation patterns.

A navigation menu with rich panels, nested items, and keyboard navigation.

Preview

No preview output yet.

live.tsxReady

Framer Motion

A navigation menu with content and submenu surfaces animated through Framer Motion and asChild composition.

Preview

No preview output yet.

live.tsxReady

Anatomy

tsx
import * as NavigationMenu from "@ariaui/navigation-menu";

export default function Example() {
  return (
    <NavigationMenu.Root>
      <NavigationMenu.List>
        <NavigationMenu.Item>
          <NavigationMenu.Trigger />
          <NavigationMenu.Content>
            <NavigationMenu.Link />
            <NavigationMenu.Sub>
              <NavigationMenu.SubTrigger />
              <NavigationMenu.SubContent>
                <NavigationMenu.Link />
              </NavigationMenu.SubContent>
            </NavigationMenu.Sub>
          </NavigationMenu.Content>
        </NavigationMenu.Item>
      </NavigationMenu.List>
    </NavigationMenu.Root>
  );
}

API Reference

Root

The top-level navigation landmark. Coordinates open/close state across menus and manages keyboard navigation.

List

Container for the horizontal list of top-level menu Items.

AttributeValues
rolemenubar
aria-labelRecommended — describes the navigation region

Item

A single top-level menu entry containing a Trigger and Content (or a Link).

PropTypeDefault
value
stringauto-generated id
AttributeValues
rolenone

Trigger

Button that opens its Content on click, Enter, Space, or ArrowDown.

PropTypeDefault
asChild
booleanfalse
AttributeValues
rolemenuitem
[data-state]open | closed
aria-haspopupmenu
aria-expandedtrue when the menu is open
aria-controlsID of the Content element

Content

Floating panel associated with a Trigger. Closes on outside click, Escape, or when focus moves outside the menu.

PropTypeDefault
asChild
booleanfalse
AttributeValues
rolemenu
[data-state]open | closed

Sub

Container for a submenu composed of SubTrigger and SubContent.

SubTrigger

Trigger that opens a submenu on hover, click, or ArrowRight.

PropTypeDefault
asChild
booleanfalse
AttributeValues
rolemenuitem
[data-state]open | closed
aria-haspopupmenu
aria-expandedtrue when the submenu is open

SubContent

Submenu panel containing nested Links. Positioned to the right of its SubTrigger.

PropTypeDefault
asChild
booleanfalse
AttributeValues
rolemenu
[data-state]open | closed

Keyboard

ShortcutAction
/Move focus between top-level Triggers along the List.
Enter/Space/Open the focused menu and move focus to its first Link or SubTrigger.
/Within an open menu, move focus to the next / previous focusable item.
On a SubTrigger, open the submenu and move focus to its first item.
Inside a submenu, close it and return focus to the SubTrigger.
Home/EndMove focus to the first / last item in the open menu.
EnterActivate the focused Link.
EscClose the open menu and return focus to its Trigger.
TabMove focus out of the navigation menu, closing any open menu.
A-Z/0-9Typeahead — move focus to the next item whose text starts with the typed characters.

Accessibility

The Navigation Menu follows the WAI-ARIA Menubar pattern adapted for site navigation:

  • Root renders as a semantic <nav> landmark.
  • List renders as role="menubar" and each Item uses role="none".
  • Trigger and SubTrigger expose aria-haspopup="menu", aria-expanded, and aria-controls.
  • Content and SubContent render as role="menu".
  • Link renders as role="menuitem" and participates in keyboard navigation.
  • Focus moves through triggers and open menus with the keyboard, and menus close when focus leaves the navigation.
Previous
Menubar