Join our Discord Community

Navigation Menu

A collection of links for navigating websites and React applications. Built with Radix UI NavigationMenu for keyboard navigation and screen reader accessibility.

You know those smooth navigation menus on modern websites? The ones where you hover and get those nice dropdown panels with organized links? That's what navigation menus do - they give you that polished, professional nav experience.

Complete navigation with mega menu

Full-featured navigation with organized content sections:

Loading component...

Built on Radix UI NavigationMenu with full keyboard support, proper focus management, and all the accessibility features users expect from modern navigation.

npx shadcn@latest add navigation-menu

Why navigation menus work so well

Regular dropdowns are fine, but navigation menus take it up a notch with better UX patterns:

  • Organized content - Group related links logically with visual hierarchy
  • Rich previews - Show descriptions, icons, or featured content
  • Smooth interactions - Hover delays and animations that feel natural
  • Keyboard friendly - Arrow keys, tab navigation, escape to close
  • Touch optimized - Works great on mobile and tablets
  • Screen reader ready - Proper ARIA labels and announcements

Perfect for modern websites

Works best when you're building something that needs organized navigation - marketing sites, documentation, SaaS apps, e-commerce. The navigation menu gives you that professional polish users expect from quality websites.

Drop it into any React or Next.js project where you want navigation that actually enhances the user experience instead of getting in their way.

Powered by Radix UI

This component is built on top of Radix UI's NavigationMenu primitive, which means you get:

  • Managed focus - Tab focus is handled automatically between triggers and content
  • Flexible viewport - Render content outside the list for advanced layouts
  • Animation variables - CSS variables for viewport dimensions during animations
  • Motion data attributes - Know which direction content is entering/exiting
  • Submenu support - Nest navigation menus for complex hierarchies
  • Delay management - Smart hover delays to prevent accidental triggers

API Reference

The root container that manages focus and keyboard navigation.

PropTypeDefaultDescription
classNamestring-Additional CSS classes
orientation"horizontal" | "vertical""horizontal"Menu orientation
childrenReact.ReactNode-NavigationMenuList component

Container for all menu items, handles layout and spacing.

PropTypeDefaultDescription
classNamestring-Additional CSS classes
childrenReact.ReactNode-NavigationMenuItem components

Individual menu item that can trigger content or be a direct link.

PropTypeDefaultDescription
classNamestring-Additional CSS classes
childrenReact.ReactNode-NavigationMenuTrigger and/or NavigationMenuContent

The clickable element that opens dropdown content.

PropTypeDefaultDescription
classNamestring-Additional CSS classes
childrenReact.ReactNode-Trigger content (text, icons)

The dropdown panel that appears when trigger is activated.

PropTypeDefaultDescription
classNamestring-Additional CSS classes
childrenReact.ReactNode-Content for the dropdown panel

Wrapper for links within navigation content, provides styling and accessibility.

PropTypeDefaultDescription
classNamestring-Additional CSS classes
asChildbooleanfalsePass styling to child element
childrenReact.ReactNode-Link content

Visual indicator that follows active menu items. Add this to create an underline or arrow that animates between triggers.

PropTypeDefaultDescription
classNamestring-Additional CSS classes
forceMountboolean-Force mount when closed

Data attributes:

  • [data-state]: "visible" | "hidden"
  • [data-orientation]: "horizontal" | "vertical"

Container that handles content positioning and animations. Radix provides CSS variables you can use for smooth size transitions.

PropTypeDefaultDescription
classNamestring-Additional CSS classes
forceMountboolean-Force mount when closed

CSS variables:

  • --radix-navigation-menu-viewport-width: Width of active content
  • --radix-navigation-menu-viewport-height: Height of active content

Helper Functions

Pre-styled classes for consistent trigger appearance.

import { navigationMenuTriggerStyle } from "@/components/ui/navigation-menu"

<NavigationMenuLink className={navigationMenuTriggerStyle()}>
  About
</NavigationMenuLink>

Keyboard Navigation

KeyAction
TabMove focus to next trigger or out of menu
Shift + TabMove focus to previous trigger
Enter / SpaceOpen focused trigger's content
Arrow DownMove focus to content or next link
Arrow UpMove focus to previous link
Arrow LeftMove to previous trigger
Arrow RightMove to next trigger
EscapeClose content and return focus
HomeFocus first trigger
EndFocus last trigger

Content Layout Patterns

LayoutUse CaseGrid Classes
Single ColumnSimple link listsgrid gap-3 p-4
Two ColumnsOrganized categoriesgrid-cols-2 gap-3 p-4
Featured + LinksHighlight key contentgrid-cols-[.75fr_1fr]
Mega MenuComplex navigationgrid-cols-4 gap-4 p-6

Build navigation that guides users

  • Keep it scannable - Group related links, use clear labels
  • Show what's important - Featured content, descriptions, icons
  • Test on devices - Make sure touch targets are good on mobile
  • Handle states - Active pages, hover effects, loading states
  • Optimize timing - Use delayDuration and skipDelayDuration props for natural hover behavior
  • Progressive disclosure - Don't overwhelm with too many options
  • Test accessibility - Keyboard navigation, screen readers, focus management
  • Use the indicator - Visual feedback helps users track where they are
  • Animate thoughtfully - Use motion data attributes for directional animations