Navigation Menu
Navigation
Overlay
Complex navigation menu with dropdown support and hover interactions for application headers.
Preview
Hover over menu items to see dropdown content
Simple Links
Navigation with simple links only
Props
Component API reference
NavigationMenu
| Prop | Type | Default | Description |
|---|---|---|---|
children* | ReactNode | — | Menu content |
className | string | — | Additional CSS classes |
delayDuration | number | 200 | Hover delay in ms before a dropdown opens |
value / defaultValue / onValueChange | string | — | Control which dropdown is open (Radix NavigationMenu props) |
NavigationMenuTrigger
| Prop | Type | Default | Description |
|---|---|---|---|
children* | ReactNode | — | Trigger content |
id | string | — | Optional and unused. Trigger and content are paired by their NavigationMenuItem |
NavigationMenuLink
| Prop | Type | Default | Description |
|---|---|---|---|
href* | string | — | Link URL |
icon | LucideIcon | — | Icon component |
description | string | — | Link description |
featured | boolean | false | Highlight as featured |
NavigationMenuDropdown
| Prop | Type | Default | Description |
|---|---|---|---|
width | number | 500 | Dropdown width in pixels |
children* | ReactNode | — | Dropdown content |
Usage
Import and implementation examples
import { NavigationMenu, NavigationMenuList, NavigationMenuItem, NavigationMenuTrigger, NavigationMenuContent, NavigationMenuLink, NavigationMenuDropdown, NavigationMenuSimpleLink,} from '@/components/ui/navigation-menu'import { Layers, Zap } from 'lucide-react'
// With dropdown menus<NavigationMenu> <NavigationMenuList> <NavigationMenuItem> <NavigationMenuTrigger> Products </NavigationMenuTrigger> <NavigationMenuContent> <NavigationMenuDropdown width={600}> <div className="grid grid-cols-2 gap-3"> <NavigationMenuLink href="/design-system" icon={Layers} description="Build beautiful interfaces" featured > Design System </NavigationMenuLink> <NavigationMenuLink href="/components" icon={Zap} description="Lightning-fast development" > Components </NavigationMenuLink> </div> </NavigationMenuDropdown> </NavigationMenuContent> </NavigationMenuItem>
<NavigationMenuItem> <NavigationMenuSimpleLink href="/pricing"> Pricing </NavigationMenuSimpleLink> </NavigationMenuItem> </NavigationMenuList></NavigationMenu>Features
Built-in functionality
- Hover interactions: Dropdowns open on hover
- Featured items: Highlight important links
- Icon support: Add icons to menu links
- Descriptions: Add context to each link
- Custom widths: Configurable dropdown widths
- Simple links: Direct navigation without dropdowns
- Grid layouts: Flexible dropdown content layouts
Accessibility
Accessibility considerations
ARIA Attributes
Built on Radix NavigationMenu: a nav landmark labelled "Main" (override with aria-label)Triggers carry aria-expanded and aria-controls pointing at their dropdownDropdown content is labelled by its trigger (aria-labelledby)Links are plain anchors, so they keep link semanticsKeyboard Navigation
| Key | Action |
|---|---|
| Tab | Move between triggers and links, and into an open dropdown |
| Arrow Left / Right | Move between top-level items |
| Enter / Space | Open or close the focused dropdown |
| Arrow Down | Move from an open trigger into its dropdown |
| Arrow keys, Home / End | Move between links inside the dropdown |
| Escape | Close the dropdown and return focus to its trigger |
Notes
- Hover opens after a short delay (delayDuration) and closes when the pointer leaves
- Clicking outside or moving focus out closes the dropdown
- Choosing a link closes the dropdown