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

ComponentPropTypeDefaultDescription
NavigationMenu.RootdefaultValuestring—Initially open item value
NavigationMenu.Rootvaluestring—Controlled open item value
NavigationMenu.RootonValueChange(value: string) => void—Called when open item changes
NavigationMenu.Rootdelaynumber50Delay in ms before opening on hover
NavigationMenu.RootsxStyleXStyles—StyleX override
NavigationMenu.Triggericons{ indicator?: ReactNode }—Replaces the built-in icons. See the Icons guide
NavigationMenu.TriggersxStyleXStyles—StyleX override
NavigationMenu.ContentsxStyleXStyles—StyleX override
NavigationMenu.Linkhrefstring—Link destination
NavigationMenu.Linkactiveboolean—Applies active styling
NavigationMenu.LinksxStyleXStyles—StyleX override
NavigationMenu.PositionersideOffsetnumber0Gap between trigger and popup
NavigationMenu.PopupsxStyleXStyles—StyleX override
NavigationMenu.ViewportsxStyleXStyles—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.
  • Root renders a semantic <nav>.
  • Arrow keys move between triggers. Enter / Space opens the content.
  • Focus is trapped inside an open panel; Escape closes and returns focus to the trigger.

Keyboard

KeyAction
ArrowLeft / ArrowRightMoves focus between triggers
ArrowDown / EnterOpens the focused trigger's content
EscapeCloses the open panel
TabMoves focus into or out of the menu