Navigation Menu

Site links on a pill whose panels open in one glass popup that resizes and slides between them.

01Preview

01

02Installation

npx shadcn@latest add https://aiellie.app/r/navigation-menu.json

03API reference

13
From the Base UI documentation

Groups all parts of the navigation menu. Renders a <nav> element at the root, or <div> element when nested.

Props

PropTypeDefaultDescription
defaultValueValue | nullnullThe uncontrolled value of the item that should be initially selected. To render a controlled navigation menu, use the value prop instead.
valueValue | nullnullThe controlled value of the navigation menu item that should be currently open. When non-nullish, the menu will be open. When nullish, the menu will be closed. To render an uncontrolled navigation menu, use the defaultValue prop instead.
onValueChange((value: Value | null, eventDetails: NavigationMenu.Root.ChangeEventDetails) => void)-Callback fired when the value changes.
actionsRefReact.RefObject<NavigationMenu.Root.Actions | null>-A ref to imperative actions.
onOpenChangeComplete((open: boolean) => void)-Event handler called after any animations complete when the navigation menu is closed.
delaynumber50How long to wait before opening the navigation popup. Specified in milliseconds.
closeDelaynumber50How long to wait before closing the navigation popup. Specified in milliseconds.
orientation'horizontal' | 'vertical''horizontal'The orientation of the navigation menu.
classNamestring | ((state: NavigationMenu.Root.State) => string | undefined)-CSS class applied to the element, or a function that returns a class based on the component's state.
styleReact.CSSProperties | ((state: NavigationMenu.Root.State) => React.CSSProperties | undefined)-Style applied to the element, or a function that returns a style object based on the component's state.
renderReactElement | ((props: HTMLProps, state: NavigationMenu.Root.State) => ReactElement)-Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render.