Skip to content

Early previewhamur is not on npm yet. The components are being built in the open, follow along on GitHub.

UIComponentsReact

Navigation Menu

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

navigation-menu.tsx

Installation

npx shadcn@4.23.0 add https://hamur.dev/r/react/navigation-menu.json

It 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.

Its preview and code are at the top of the page.

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.