Navigation Menu
A horizontal list of nav items with hoverable dropdown panels — the canonical top-nav primitive.
Import
import { NavigationMenu } from '@matix/components/navigation-menu';Usage
Anatomy
The Root, List, Item, Trigger, and Content parts live inline in the page. The Portal, Positioner, Popup, and Viewport parts live in a portal — the viewport animates its size between items so dropdowns feel connected.
Server Components
NavigationMenu is a client component. A Server Component cannot read a property of a client component, so NavigationMenu.Root is undefined there. In a Server Component, import the named parts. Each NavigationMenu.<Part> is also exported as NavigationMenu<Part>.
import {
NavigationMenuRoot,
NavigationMenuList,
NavigationMenuItem,
NavigationMenuTrigger,
NavigationMenuContent,
NavigationMenuLink,
NavigationMenuPortal,
NavigationMenuPositioner,
NavigationMenuPopup,
NavigationMenuViewport,
} from '@matix/components/navigation-menu';In a client component, both forms work.
API Reference
| Component | Prop | Type | Default | Description |
|---|---|---|---|---|
NavigationMenu.Root | defaultValue | string | — | Initially open item value |
NavigationMenu.Root | value | string | — | Controlled open item value |
NavigationMenu.Root | onValueChange | (value: string) => void | — | Called when open item changes |
NavigationMenu.Root | delay | number | 50 | Delay in ms before opening on hover |
NavigationMenu.Root | sx | StyleXStyles | — | StyleX override |
NavigationMenu.Trigger | icons | { indicator?: ReactNode } | — | Replaces the built-in icons. See the Icons guide |
NavigationMenu.Trigger | sx | StyleXStyles | — | StyleX override |
NavigationMenu.Content | sx | StyleXStyles | — | StyleX override |
NavigationMenu.Link | href | string | — | Link destination |
NavigationMenu.Link | active | boolean | — | Applies active styling |
NavigationMenu.Link | sx | StyleXStyles | — | StyleX override |
NavigationMenu.Positioner | sideOffset | number | 0 | Gap between trigger and popup |
NavigationMenu.Popup | sx | StyleXStyles | — | StyleX override |
NavigationMenu.Viewport | sx | StyleXStyles | — | StyleX override |
All other props are forwarded to the underlying Base UI element.
Accessibility
- Built on Base UI
NavigationMenu— implements WAI-ARIA navigation menu pattern. Rootrenders a semantic<nav>.- Arrow keys move between triggers.
Enter/Spaceopens the content. - Focus is trapped inside an open panel;
Escapecloses and returns focus to the trigger.
Keyboard
| Key | Action |
|---|---|
ArrowLeft / ArrowRight | Moves focus between triggers |
ArrowDown / Enter | Opens the focused trigger's content |
Escape | Closes the open panel |
Tab | Moves focus into or out of the menu |