Overview
Navigation Menu provides a collection of links for navigating through your website. It features keyboard navigation, delayed interactions, and automatic viewport management for dropdown content.Features
- Full keyboard navigation with arrow keys
- Automatic focus management
- Flexible orientation (horizontal or vertical)
- Configurable hover delay and skip delay durations
- Animated content transitions with viewport
- Optional indicators for active items
- Screen reader friendly with proper ARIA attributes
- Supports nested sub-menus
Installation
Anatomy
API Reference
Root
The root component of the navigation menu.The controlled value of the menu item to expand.
The value of the menu item to expand by default (uncontrolled).
Callback fired when the expanded item changes.
The orientation of the menu.
The reading direction. If omitted, inherits from the parent.
The duration from when the pointer enters the trigger until the content opens (in milliseconds).
How much time a user has to enter another trigger without incurring a delay again (in milliseconds).
List
Contains the navigation menu items and indicators.Change the default rendered element for the one passed as a child.
Item
A top-level menu item, containing a trigger with content combination or a link.A unique value that associates the item with a content.
Change the default rendered element for the one passed as a child.
Trigger
The button that toggles the content.Change the default rendered element for the one passed as a child.
Content
Contains the content associated with a trigger.Used to force mounting when more control is needed. Useful when controlling animation with React animation libraries.
Change the default rendered element for the one passed as a child.
Link
A navigational link.Used to identify the link as the currently active page.
Callback fired when the link is selected.
Change the default rendered element for the one passed as a child.
Indicator
An optional animated indicator that highlights the currently active trigger.Used to force mounting when more control is needed.
Change the default rendered element for the one passed as a child.
Viewport
The viewport where expanded content is rendered. Automatically sizes itself to the content.Used to force mounting when more control is needed.
Change the default rendered element for the one passed as a child.
Sub
Signifies a submenu. Inherits context from the root.A unique value that associates the item with a content.
The value of the menu item to expand by default.
Callback fired when the expanded item changes.
The orientation of the submenu.
Example
Accessibility
Adheres to the Navigation WAI-ARIA design pattern.
Keyboard Interactions
- Space/Enter - Opens/closes the content.
- Tab - Moves focus to the next focusable element.
- Shift + Tab - Moves focus to the previous focusable element.
- ArrowDown - When horizontal, moves focus to the next trigger. When vertical, opens the content.
- ArrowUp - When horizontal, moves focus to the previous trigger. When vertical, closes the content.
- ArrowRight - When horizontal, opens the content. When vertical, moves focus to the next trigger.
- ArrowLeft - When horizontal, closes the content. When vertical, moves focus to the previous trigger.
- Home/End - Moves focus to the first/last trigger.