
Horizontal navigation menu with dropdown content panels and links.
npx shadcn@latest add https://ui.edbn.me/api/analytics/registry/navigation-menu.jsonGroups all parts of the navigation menu. Renders nav at the top level, or div when nested.
actionsRefReact.RefObject<{ unmount: () => void } | null>Imperative actions ref exposed by Base UI.
onOpenChangeComplete(open: boolean) => voidCalled after close animations finish.
valueValue | nullnullControlled value for the currently open item.
defaultValueValue | nullnullInitial uncontrolled value for the open item.
onValueChange(value: Value | null, details) => voidCalled when the open item value changes.
delaynumber50Delay in milliseconds before opening on hover.
closeDelaynumber50Delay in milliseconds before closing on hover out.
orientation'horizontal' | 'vertical''horizontal'Navigation direction used by keyboard navigation.
classNamestring | ((state) => string | undefined)CSS class name, or a callback that receives Base UI state.
styleReact.CSSProperties | ((state) => React.CSSProperties | undefined)Inline style object, or a callback that receives Base UI state.
renderReactElement | ((props, state) => ReactElement)Custom element or render function for composition.
Contains the top-level navigation menu items. Renders ul.
classNamestring | ((state) => string | undefined)CSS class name, or a callback that receives Base UI state.
styleReact.CSSProperties | ((state) => React.CSSProperties | undefined)Inline style object, or a callback that receives Base UI state.
renderReactElement | ((props, state) => ReactElement)Custom element or render function for composition.
An individual top-level navigation menu item. Renders li.
valueanyauto-generatedUnique item value. Provide this when controlling Root.value.
classNamestring | ((state) => string | undefined)CSS class name, or a callback that receives Base UI state.
styleReact.CSSProperties | ((state) => React.CSSProperties | undefined)Inline style object, or a callback that receives Base UI state.
renderReactElement | ((props, state) => ReactElement)Custom element or render function for composition.
Button that opens the associated content on hover, click, or keyboard activation.
nativeButtonbooleantrueSet false when render replaces the button with a non-button element.
classNamestring | ((state) => string | undefined)CSS class name, or a callback that receives Base UI state.
styleReact.CSSProperties | ((state) => React.CSSProperties | undefined)Inline style object, or a callback that receives Base UI state.
renderReactElement | ((props, state) => ReactElement)Custom element or render function for composition.
| Attribute | Description |
|---|---|
| data-popup-open | Present when the associated menu item is open. |
| data-pressed | Present while the trigger is pressed. |
Indicator associated with the trigger. Renders span.
classNamestring | ((state) => string | undefined)CSS class name, or a callback that receives Base UI state.
styleReact.CSSProperties | ((state) => React.CSSProperties | undefined)Inline style object, or a callback that receives Base UI state.
renderReactElement | ((props, state) => ReactElement)Custom element or render function for composition.
| Attribute | Description |
|---|---|
| data-popup-open | Present when the associated trigger is open. |
Panel content for a menu item. It is moved into Viewport while active.
keepMountedbooleanfalseKeep content in the DOM while closed; useful for SSR-visible links.
classNamestring | ((state) => string | undefined)CSS class name, or a callback that receives Base UI state.
styleReact.CSSProperties | ((state) => React.CSSProperties | undefined)Inline style object, or a callback that receives Base UI state.
renderReactElement | ((props, state) => ReactElement)Custom element or render function for composition.
| Attribute | Description |
|---|---|
| data-open | Present when the popup is open. |
| data-closed | Present when the popup is closed. |
| data-starting-style | Present while the part is animating in. |
| data-ending-style | Present while the part is animating out. |
| data-activation-direction | Direction another trigger was activated from: left, right, up, or down. |
Navigation link inside a menu panel. Renders a.
activebooleanfalseMarks the link as representing the current page.
closeOnClickbooleanfalseClose the navigation menu when the link is clicked.
classNamestring | ((state) => string | undefined)CSS class name, or a callback that receives Base UI state.
styleReact.CSSProperties | ((state) => React.CSSProperties | undefined)Inline style object, or a callback that receives Base UI state.
renderReactElement | ((props, state) => ReactElement)Custom element or render function for composition.
| Attribute | Description |
|---|---|
| data-active | Present when active is true. |
Optional backdrop behind the popup. Renders div.
classNamestring | ((state) => string | undefined)CSS class name, or a callback that receives Base UI state.
styleReact.CSSProperties | ((state) => React.CSSProperties | undefined)Inline style object, or a callback that receives Base UI state.
renderReactElement | ((props, state) => ReactElement)Custom element or render function for composition.
| Attribute | Description |
|---|---|
| data-open | Present when the popup is open. |
| data-closed | Present when the popup is closed. |
| data-starting-style | Present while the part is animating in. |
| data-ending-style | Present while the part is animating out. |
Moves the popup to document.body or to a custom container. Renders div.
keepMountedbooleanfalseKeep the portal mounted while the popup is hidden.
containerHTMLElement | null | React.RefObject<HTMLElement | null>document.bodyParent element that receives the portal.
classNamestring | ((state) => string | undefined)CSS class name, or a callback that receives Base UI state.
styleReact.CSSProperties | ((state) => React.CSSProperties | undefined)Inline style object, or a callback that receives Base UI state.
renderReactElement | ((props, state) => ReactElement)Custom element or render function for composition.
Positions the popup against the active trigger or a custom anchor.
anchorElement | VirtualElement | RefObject | (() => Element | null)active triggerCustom element or virtual element to position against.
positionMethod'absolute' | 'fixed''absolute'CSS positioning strategy.
side'top' | 'bottom' | 'left' | 'right' | 'inline-start' | 'inline-end''bottom'Preferred side relative to the anchor.
sideOffsetnumber | ((data) => number)10Wrapper spacing from anchor; Base UI default is 0.
align'start' | 'center' | 'end''center'Preferred alignment along the anchor.
alignOffsetnumber | ((data) => number)0Offset along the alignment axis.
collisionBoundary'clipping-ancestors' | Element | Element[] | Rect'clipping-ancestors'Boundary used for collision detection.
collisionPaddingnumber | { top?: number; right?: number; bottom?: number; left?: number }16Wrapper collision padding; Base UI default is 5.
stickybooleanfalseKeep the popup in view after the anchor scrolls away.
arrowPaddingnumber5Minimum spacing between arrow and popup edge.
disableAnchorTrackingbooleanfalseDisable tracking layout shifts of the anchor.
collisionAvoidance{ side?: 'flip' | 'shift' | 'none'; align?: 'flip' | 'shift' | 'none'; fallbackAxisSide?: 'start' | 'end' | 'none' }Collision behavior for side, alignment, and fallback axis.
classNamestring | ((state) => string | undefined)CSS class name, or a callback that receives Base UI state.
styleReact.CSSProperties | ((state) => React.CSSProperties | undefined)Inline style object, or a callback that receives Base UI state.
renderReactElement | ((props, state) => ReactElement)Custom element or render function for composition.
| Attribute | Description |
|---|---|
| data-open | Present when the popup is open. |
| data-closed | Present when the popup is closed. |
| data-anchor-hidden | Present when the anchor element is hidden. |
| data-side | Resolved side: top, bottom, left, right, inline-start, or inline-end. |
| data-align | Resolved alignment: start, center, or end. |
| data-instant | Present when CSS transitions should be disabled. |
| Variable | Description |
|---|---|
| --available-width | Available width before collision with the boundary. |
| --available-height | Available height before collision with the boundary. |
| --anchor-width | Width of the active trigger or custom anchor. |
| --anchor-height | Height of the active trigger or custom anchor. |
| --transform-origin | Anchor-aware transform origin for popup animation. |
| --positioner-width | Measured width used to match the active content panel. |
| --positioner-height | Measured height used to match the active content panel. |
Popup surface that contains the active viewport. Renders nav.
classNamestring | ((state) => string | undefined)CSS class name, or a callback that receives Base UI state.
styleReact.CSSProperties | ((state) => React.CSSProperties | undefined)Inline style object, or a callback that receives Base UI state.
renderReactElement | ((props, state) => ReactElement)Custom element or render function for composition.
| Attribute | Description |
|---|---|
| data-open | Present when the popup is open. |
| data-closed | Present when the popup is closed. |
| data-starting-style | Present while the part is animating in. |
| data-ending-style | Present while the part is animating out. |
| data-side | Resolved side: top, bottom, left, right, inline-start, or inline-end. |
| data-align | Resolved alignment: start, center, or end. |
| Variable | Description |
|---|---|
| --popup-width | Measured width of the active content panel. |
| --popup-height | Measured height of the active content panel. |
Clipping viewport for the currently active content. Renders div.
classNamestring | ((state) => string | undefined)CSS class name, or a callback that receives Base UI state.
styleReact.CSSProperties | ((state) => React.CSSProperties | undefined)Inline style object, or a callback that receives Base UI state.
renderReactElement | ((props, state) => ReactElement)Custom element or render function for composition.
Optional element pointing from popup toward the active trigger.
classNamestring | ((state) => string | undefined)CSS class name, or a callback that receives Base UI state.
styleReact.CSSProperties | ((state) => React.CSSProperties | undefined)Inline style object, or a callback that receives Base UI state.
renderReactElement | ((props, state) => ReactElement)Custom element or render function for composition.
| Attribute | Description |
|---|---|
| data-open | Present when the popup is open. |
| data-closed | Present when the popup is closed. |
| data-side | Resolved side: top, bottom, left, right, inline-start, or inline-end. |
| data-align | Resolved alignment: start, center, or end. |
| data-uncentered | Present when the arrow cannot be centered on the anchor. |