Skip to main content

Navigation Menu

StorybookView in Storybook

Explore interactive examples and all component variations in our Storybook.

The NavigationMenu component provides a flexible navigation system with dropdown menus and submenus. Built on Radix UI primitives, it supports keyboard navigation, hover interactions, and responsive design.

Basic Usage

Grid Layout Menu

List Style Menu

Properties

PropertyTypeDescription
viewportbooleanWhether to render the viewport container. Default: true.
classNamestringAdditional CSS classes for custom styling.
childrenReact.ReactNodeThe navigation menu content.
PropertyTypeDescription
classNamestringAdditional CSS classes for custom styling.
childrenReact.ReactNodeThe navigation menu items.
PropertyTypeDescription
classNamestringAdditional CSS classes for custom styling.
childrenReact.ReactNodeThe menu item content (trigger and/or content).
PropertyTypeDescription
classNamestringAdditional CSS classes for custom styling.
childrenReact.ReactNodeThe trigger content (usually text).
PropertyTypeDescription
classNamestringAdditional CSS classes for custom styling.
childrenReact.ReactNodeThe dropdown content.
PropertyTypeDescription
hrefstringThe URL to navigate to when clicked.
activebooleanWhether this link represents the current page.
classNamestringAdditional CSS classes for custom styling.
childrenReact.ReactNodeThe link content.

Layout Patterns

Grid Layouts

  • Two Column - grid-cols-2 for balanced content
  • Three Column - grid-cols-3 for more options
  • Auto Grid - grid-cols-[repeat(auto-fit,minmax(200px,1fr))] for responsive

List Layouts

  • Simple List - Basic vertical list of links
  • Grouped Lists - Multiple sections with headers
  • Icon Lists - Links with accompanying icons

Custom Layouts

  • Mixed Content - Combine different content types
  • Featured Items - Highlight important links
  • Rich Content - Include images, descriptions, badges

Accessibility

The NavigationMenu component includes comprehensive accessibility features:

  • Keyboard Navigation - Arrow keys, Enter, Escape, Tab support
  • Focus Management - Proper focus handling and restoration
  • Screen Reader Support - ARIA attributes and roles for assistive technologies
  • Hover and Focus - Consistent behavior across interaction methods
  • Active States - Clear indication of current page/section

Common Use Cases

The NavigationMenu component is perfect for:

  • Website Headers - Main site navigation with dropdowns
  • Application Menus - Complex app navigation structures
  • Product Catalogs - Organized product category navigation
  • Documentation Sites - Hierarchical content organization
  • Dashboard Navigation - Admin panel and user interface menus
  • E-commerce Sites - Product category and filter navigation

Best Practices

  1. Logical Grouping - Group related items together in dropdowns
  2. Clear Labels - Use descriptive, easy-to-understand menu labels
  3. Reasonable Depth - Avoid deeply nested menu structures
  4. Mobile Considerations - Ensure menus work well on touch devices
  5. Performance - Lazy load content in large menus when possible
  6. Visual Hierarchy - Use typography and spacing to create clear hierarchy
  7. Consistent Styling - Maintain consistent visual treatment across menus
  8. Active States - Clearly indicate the current page or section