UIComponentsReact
A site's top navigation, whose items open panels of links.
Built on the headless Navigation Menu.See its API in Docs
Rendered by React 19.3.1
Installation
npx shadcn@4.23.0 add https://hamur.dev/r/react/navigation-menu.jsonIt also adds utils. The app needs its setup first: Installation.
Usage
NavigationMenu holds NavigationMenuList, and the list a NavigationMenuItem per entry. An item with a panel has NavigationMenuTrigger and NavigationMenuContent; an item that is only a link has a NavigationMenuLink, and navigationMenuTriggerStyle() gives that link the trigger's look. NavigationMenu renders the positioner and viewport for the panels itself, and its align (start by default) places them. Moving between triggers, the panels' size animation and the links' roles come from the headless Navigation Menu.
import {
NavigationMenu,
NavigationMenuContent,
NavigationMenuIndicator,
NavigationMenuItem,
NavigationMenuLink,
NavigationMenuList,
NavigationMenuPositioner,
NavigationMenuTrigger,
} from '@/components/ui/navigation-menu'Examples
Default
Two triggers with panels of links, and a plain link.
API reference
The styled parts pass every prop to the headless part they wrap and add classes. The props, data attributes and keyboard are on Navigation Menu's API reference.