Installation
- CLI
- Manual
Usage
Import all parts and piece them together:Basic Example
Complete Example
API Reference
NavigationMenu
The root component that wraps all navigation menu items.Props to pass to the internal positioner component. Includes positioning options like
sideOffset and collisionPadding.Additional CSS classes to apply to the navigation menu root.
NavigationMenuList
Wrapper for navigation menu items.Additional CSS classes to apply to the list.
NavigationMenuItem
Container for a single navigation menu item with optional content.Additional CSS classes to apply to the menu item.
NavigationMenuTrigger
Button that triggers the dropdown content.Additional CSS classes to apply to the trigger button.
NavigationMenuContent
The dropdown content that appears when a trigger is activated.Additional CSS classes to apply to the content container.
NavigationMenuLink
A link item within the navigation menu.Custom render function for the link element.
Additional CSS classes to apply to the link.
NavigationMenuViewport
Viewport that contains all dropdown content with smooth transitions.Configuration for positioning:
sideOffset(number): Offset from the trigger element (default: 6)collisionPadding(object): Padding for collision detection (default:{top: 5, bottom: 5, left: 20, right: 20})
navigationMenuTriggerStyle
A CVA function that returns the default trigger button styles. Use this for standalone links that should match the trigger appearance:Features
- Keyboard Navigation: Full keyboard support with arrow keys and tab navigation
- Smooth Animations: Built-in transitions for opening and closing content
- Flexible Layouts: Content supports any layout with CSS Grid or Flexbox
- Nested Menus: Support for nested sub-menus with
NavigationSubMenuTrigger - Collision Detection: Automatic positioning adjustments to stay within viewport
- Accessible: Built on Base UI primitives with ARIA attributes
Accessibility
- Uses semantic HTML with proper ARIA attributes
- Full keyboard navigation support
- Focus management for keyboard users
- Screen reader announcements for state changes
