NavigationMenu

Navigation

A site's or app's main navigation: <NavigationMenu.Root> holds a NavigationMenu.List of NavigationMenu.Items. An item is a NavigationMenu.Link (style it with navigationMenuTriggerStyle() at the top level; active marks the current page) or a NavigationMenu.Trigger with a NavigationMenu.Content panel of links. Panels open on hover or click, in a shared viewport below the bar (viewport={false} places each under its trigger). Arrow keys move along the bar, Escape closes a panel.

import { NavigationMenu } from '@limerdev/zest';
NavigationMenu for AI tools (llms.txt)
Use for
A top bar with a few sections, some with sub-pages to choose from.
Don't
Actions rather than pages: use DropdownMenu or Menubar. Many sections in an admin app: a sidebar of links.

Examples

Basic

Triggers open panels of links in a shared box below the bar; a top-level link uses navigationMenuTriggerStyle(). active marks the current page.

Props

Every part also takes class (merged over its defaults), ref (bindable: the element), children, and child (a snippet that renders your own element, with props to spread on it).

NavigationMenu.Root

Prop Type Default Description
delayDuration number 200 The amount of time in ms from when the mouse enters a trigger until the content opens.
dir "ltr" | "rtl" "ltr" The reading direction of the content.
onValueChange OnChangeFn<string> – The callback to call when a menu item is selected.
orientation "horizontal" | "vertical" – The orientation of the menu.
skipDelayDuration number 300 The amount of time in ms that a user has to enter another trigger without incurring a delay again.
value bindable string '' The value of the currently open menu item.
viewport boolean true Open every panel in one shared box below the bar; false opens each under its trigger.

NavigationMenu.List

No props of its own beyond the common ones.

NavigationMenu.Item

Prop Type Default Description
openOnHover boolean true Whether to open the menu associated with the item when the item's trigger is hovered.
value string – The value of the menu item.

NavigationMenu.Trigger

Prop Type Default Description
disabled null | false | true false Whether the trigger is disabled.

NavigationMenu.Content

Prop Type Default Description
escapeKeydownBehavior "close" | "defer-otherwise-close" | "defer-otherwise-ignore" | "ignore" – Behavior when the escape key is pressed while the menu content is open.
forceMount boolean false Whether to forcefully mount the content, regardless of the open state. This is useful when wanting to use more custom transition and animation libraries.
interactOutsideBehavior "close" | "defer-otherwise-close" | "defer-otherwise-ignore" | "ignore" – Behavior when an interaction occurs outside the content.
onEscapeKeydown ((event: KeyboardEvent) => void) – Callback fires when an escape keydown event occurs. Default behavior can be prevented with event.preventDefault()
onFocusOutside ((event: FocusEvent) => void) – Callback fired when a focus event occurs outside the content. Default behavior can be prevented with event.preventDefault()
onInteractOutside ((event: PointerEvent) => void) – Callback fired when an interaction occurs outside the content. Default behavior can be prevented with event.preventDefault()
Prop Type Default Description
active boolean – Whether the link is the current active page
onSelect ((e: Event) => void) – A callback fired when the link is clicked. Default behavior can be prevented with event.preventDefault()

NavigationMenu.Viewport

Prop Type Default Description
forceMount boolean false Whether to forcefully mount the content, regardless of the open state. This is useful when wanting to use more custom transition and animation libraries.

NavigationMenu.Indicator

Prop Type Default Description
forceMount boolean false Whether to forcefully mount the content, regardless of the open state. This is useful when wanting to use more custom transition and animation libraries.

NavigationMenu.Sub

Prop Type Default Description
onValueChange OnChangeFn<string> – A callback fired when the active menu item changes.
orientation "horizontal" | "vertical" – The orientation of the menu.
value bindable string – The value of the currently open menu item within the menu.