Navigation Menu
A collection of links for navigating websites.
Made by shadcnInstallation
Base UI migration — NavigationMenuIndicator is rendered as a no-op <div>. Base UI's navigation-menu
primitive has no Indicator part and there is no clean way to emulate Radix's auto-sized indicator animation. The
export name and className are preserved so code still compiles. See
MIGRATION.md.
Loading component...
When to use
The Navigation Menu component provides structured navigation with dropdowns and nested content. Use this decision tree to determine when it's appropriate:
Usage
import {
NavigationMenu,
NavigationMenuContent,
NavigationMenuIndicator,
NavigationMenuItem,
NavigationMenuLink,
NavigationMenuList,
NavigationMenuTrigger,
NavigationMenuViewport,
} from "@/components/ui/navigation-menu"<NavigationMenu>
<NavigationMenuList>
<NavigationMenuItem>
<NavigationMenuTrigger>Item One</NavigationMenuTrigger>
<NavigationMenuContent>
<NavigationMenuLink>Link</NavigationMenuLink>
</NavigationMenuContent>
</NavigationMenuItem>
</NavigationMenuList>
</NavigationMenu>Examples
Link Component
When using the Next.js <Link /> component, you can use navigationMenuTriggerStyle() to apply the correct styles to the trigger.
import { navigationMenuTriggerStyle } from "@/components/ui/navigation-menu"<NavigationMenuItem>
<Link href="/docs" legacyBehavior passHref>
<NavigationMenuLink className={navigationMenuTriggerStyle()}>
Documentation
</NavigationMenuLink>
</Link>
</NavigationMenuItem>See also the Base UI documentation for handling client side routing.
Panel dropdowns
Loading component...
Multi-level nested
Loading component...
Inline submenus
Loading component...
Large scrollable panel
Loading component...
Custom link component
Loading component...
Rich content mega-menu
Loading component...
Featured card
Loading component...
Vertical orientation
Loading component...
Props
Keyboard interactions
| Key | Action |
|---|---|
Tab into NavigationMenuList | Focus lands on the first top-level trigger. |
ArrowLeft / ArrowRight | Moves between top-level triggers. |
ArrowDown / Enter / Space | Opens the focused trigger's content panel and moves focus inside. |
Tab inside a content panel | Cycles focus through the panel's links. |
Escape | Closes the open panel and restores focus to the trigger. |
Accessibility
- The menu container is
role="menubar"(ornavigationsemantics when used as site nav). Use a real<nav>wrapper and give it anaria-labelwhen there are multiple navigation regions on the page. - Links inside panels must be real
<a>elements — wrap a framework-router link withasChildonNavigationMenuLinkso keyboard activation and focus handling still work. - Base UI note:
NavigationMenuIndicatoris a no-op<div>— no auto-sized animated indicator is rendered. Use a custom element or additional CSS if you want this effect. See the migration callout. - Always provide a keyboard-accessible hamburger / skip-link on small screens; the navigation menu primitive is desktop-first.
Credits
- We use Base UI for the navigation menu component.
- We take our inspiration from Shadcn UI for the navigation menu style.
Recent changes
- patchv1.2.0Pin shipped dependency floors to the version we develop against. Registry items now declare ranges like `^5.1.9` (the actual installed version) instead of collapsing to `^5.0.0`, so consumers start on the known-tested b…#133
- minorv1.1.0Theme docs refresh, readability pass on semantic foregrounds, and consumer-facing Base UI regression fixes.#121
- minorv1.0.0Post-Base-UI polish. Public API unchanged.#116
- majorv1.0.0Migrate every Radix-based primitive to `@base-ui/react@^1.4.0` (Base UI).#114
- patchv0.3.1**Accordion** - `AccordionTrigger` now shows `cursor-pointer` on hover.#112
Built by malinskibeniamin. The source code is available on GitHub.