Navigation Menu
The links at the top of a site, with panels of links that open under them: product menus, docs, resources.
Installation
Or with the shadcn CLI, from the registry:
Usage
Every panel opens in one popup that moves under the open trigger and resizes to the panel, so moving from one trigger
to the next slides the content instead of closing and reopening a menu. A link at the top level takes
navigationMenuTriggerStyle() to look like a trigger.
Router links and the current page
NavigationMenuLink is an <a>; give your router's link in render. active marks the current page with
aria-current="page" and a fill.
On phones
The menu is for wide screens. Below md, show the same links in a Sheet opened from a menu button
instead, as landing headers do.
Villages
Triggers take the village's control face and case (mono capitals in Iwa); the popup is a popover surface with the village's radius, border, shadow and motion.
Accessibility
- Base UI's navigation menu: a
<nav>with a list. Triggers are buttons witharia-expanded; the arrow keys move between them, Enter or Space opens a panel, Tab enters it, Escape closes it and returns focus to its trigger. - Panels open on hover after a short delay, and on click; nothing is reachable by hover alone.
- Icons in links are decorative (
aria-hidden); the link text names the link.
API reference
| Component | Props |
|---|---|
NavigationMenu | Base UI NavigationMenu.Root (value, onValueChange, delay…), plus the popup's side, sideOffset, align (default "start") and alignOffset |
NavigationMenuList, NavigationMenuItem | Base UI List and Item |
NavigationMenuTrigger | Base UI Trigger, with a chevron that turns when the panel is open |
NavigationMenuContent | Base UI Content: the panel |
NavigationMenuLink | Base UI Link: href, active, closeOnClick, render |
navigationMenuTriggerStyle() returns a trigger's classes, for a link at the top level.