Skip to content

Navigation Menu

A collection of links for navigating websites.

Installation

npm i @huin-core/react-navigation-menu

API Reference

NavigationMenu

PropTypeDescription
defaultValueSpecifies the initial value of the component when it is first rendered, before any user interaction or dynamic updates.
valuestringRepresents the current value or state of the component, which can be used to bind or track its data over time.
onValueChangefunctionEvent handler called when the value changes.
delayDurationnumberSpecifies the amount of time to wait before an action or effect is triggered, often used to control the timing of interactions or animations.
skipDelayDurationnumberHow much time a user has to enter another trigger without incurring a delay again.
dir"ltr" | "rtl"The reading direction. If omitted, inherits globally from DirectionProvider or assumes LTR (left-to-right) reading mode.
orientation"vertical" | "horizontal"Specifies the direction or layout of the component, determining whether it is displayed vertically or horizontally.

NavigationMenuSub

PropTypeDescription
defaultValueSpecifies the initial value of the component when it is first rendered, before any user interaction or dynamic updates.
valuestringRepresents the current value or state of the component, which can be used to bind or track its data over time.
onValueChangefunctionEvent handler called when the value changes.
orientation"vertical" | "horizontal"Specifies the direction or layout of the component, determining whether it is displayed vertically or horizontally.

NavigationMenuList

PropTypeDescription
asChildbooleanWhen set to true, renders the component as its child element, inheriting the child's styles and behavior.

NavigationMenuItem

PropTypeDescription
asChildbooleanWhen set to true, renders the component as its child element, inheriting the child's styles and behavior.
valuestringRepresents the current value or state of the component, which can be used to bind or track its data over time.

NavigationMenuTrigger

PropTypeDescription
asChildbooleanWhen set to true, renders the component as its child element, inheriting the child's styles and behavior.

NavigationMenuContent

PropTypeDescription
asChildbooleanWhen set to true, renders the component as its child element, inheriting the child's styles and behavior.
onEscapeKeyDownfunctionEvent handler called when the escape key is down. It can be prevented by calling event.preventDefault.
onPointerDownOutsidefunctionEvent handler called when a pointer event occurs outside the bounds of the component. It can be prevented by calling event.preventDefault
onFocusOutsidefunctionEvent handler called when focus moves outside the bounds of the component. It can be prevented by calling event.preventDefault.
onInteractOutsidefunctionEvent handler called when an interaction (pointer or focus event) happens outside the bounds of the component. It can be prevented by calling event.preventDefault.
forceMountbooleanUsed to force mounting when more control is needed. Useful when controlling animation with React animation libraries. It inherits from.

NavigationMenuLink

PropTypeDescription
asChildbooleanWhen set to true, renders the component as its child element, inheriting the child's styles and behavior.
activebooleanUsed to identify the link as the currently active page.
onSelectfunctionEvent handler called when the user selects an item (via mouse or keyboard). Calling event.preventDefault in this handler will prevent the menubar from closing when selecting that item.

NavigationMenuIndicator

PropTypeDescription
asChildbooleanWhen set to true, renders the component as its child element, inheriting the child's styles and behavior.
forceMountbooleanUsed to force mounting when more control is needed. Useful when controlling animation with React animation libraries. It inherits from.

NavigationMenuViewport

PropTypeDescription
asChildbooleanWhen set to true, renders the component as its child element, inheriting the child's styles and behavior.
forceMountbooleanUsed to force mounting when more control is needed. Useful when controlling animation with React animation libraries. It inherits from.

Keyboard Interactions

KeyDescription
Space
Enter
Opens the focused item's content.
ArrowDown
Moves focus into the open content.
Esc
Closes the open content.