Import
Basic Usage
Key Components
NavigationMenu.Root
Groups all parts of the navigation menu. Renders a<nav> element at the root, or <div> element when nested.
Key Props:
value:any- The controlled value of the navigation menu item that should be currently opendefaultValue:any- The uncontrolled value of the item that should be initially selected (default:null)onValueChange:(value: any, eventDetails: ChangeEventDetails) => void- Callback fired when the value changesorientation:'horizontal' | 'vertical'- The orientation of the navigation menu (default:'horizontal')delay:number- How long to wait before opening the navigation menu, in milliseconds (default:50)closeDelay:number- How long to wait before closing the navigation menu, in milliseconds (default:50)onOpenChangeComplete:(open: boolean) => void- Event handler called after any animations complete when the navigation menu is closed
data-open: Present when the popup is opendata-nested: Present when the navigation menu is nested
NavigationMenu.List
Contains the navigation menu items. Renders a<div> element.
NavigationMenu.Item
Wraps a trigger and content pair. Renders a<div> element.
Key Props:
value:any- The unique value for this navigation item (required)
NavigationMenu.Trigger
A button that opens the navigation menu content. Renders a<button> element.
State:
data-open: Present when the associated content is opendata-disabled: Present when the trigger is disabled
NavigationMenu.Popup
A container for the navigation content. Renders a<div> element.
State:
data-open: Present when the popup is opendata-side: The side of the anchor element where the popup is positioneddata-align: The alignment of the popup relative to the anchor
NavigationMenu.Content
The content area of the navigation menu. Renders a<div> element.
NavigationMenu.Link
A link item within the navigation menu. Renders an<a> element.
Key Props:
href:string- The URL the link points toactive:boolean- Whether the link represents the current page
data-active: Present when the link is active
NavigationMenu.Viewport
An optional viewport for animating content transitions. Renders a<div> element.
Features
- Hover-based navigation with configurable delays
- Keyboard navigation support
- Nested menu support
- Active link indication
- Flexible positioning with
NavigationMenu.Positioner - Optional backdrop with
NavigationMenu.Backdrop - Portal rendering with
NavigationMenu.Portal - Smooth transitions with
NavigationMenu.Viewport - Accessible ARIA attributes