# NavigationMenu (@limerdev/zest) A site's or app's main navigation: `` holds a `NavigationMenu.List` of `NavigationMenu.Item`s. 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. - Category: Navigation - Import: `import { NavigationMenu, navigationMenuTriggerStyle } from '@limerdev/zest'` - Bits UI: `NavigationMenu`, https://bits-ui.com/docs/components/navigation-menu - Exports: `NavigationMenu.Root`, `NavigationMenu.List`, `NavigationMenu.Item`, `NavigationMenu.Trigger`, `NavigationMenu.Content`, `NavigationMenu.Link`, `NavigationMenu.Viewport`, `NavigationMenu.Indicator`, `NavigationMenu.Sub`, `navigationMenuTriggerStyle` - 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. ```svelte Reports Hours Invoices Settings ``` Props of `NavigationMenu.Root`: - `delayDuration` (`number`, default `200`): The amount of time in ms from when the mouse enters a trigger until the content opens. - `dir` (`"ltr" | "rtl"`, default `"ltr"`): The reading direction of the content. - `onValueChange` (`OnChangeFn`): The callback to call when a menu item is selected. - `orientation` (`"horizontal" | "vertical"`): The orientation of the menu. - `skipDelayDuration` (`number`, default `300`): The amount of time in ms that a user has to enter another trigger without incurring a delay again. - `value` (`string`, default `''`, bindable): The value of the currently open menu item. - `viewport` (`boolean`, default `true`): Open every panel in one shared box below the bar; `false` opens each under its trigger. Props of `NavigationMenu.Item`: - `openOnHover` (`boolean`, default `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. Props of `NavigationMenu.Trigger`: - `disabled` (`null | false | true`, default `false`): Whether the trigger is disabled. Props of `NavigationMenu.Content`: - `escapeKeydownBehavior` (`"close" | "defer-otherwise-close" | "defer-otherwise-ignore" | "ignore"`): Behavior when the escape key is pressed while the menu content is open. - `forceMount` (`boolean`, default `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()` Props of `NavigationMenu.Link`: - `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()` Props of `NavigationMenu.Viewport`: - `forceMount` (`boolean`, default `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. Props of `NavigationMenu.Indicator`: - `forceMount` (`boolean`, default `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. Props of `NavigationMenu.Sub`: - `onValueChange` (`OnChangeFn`): A callback fired when the active menu item changes. - `orientation` (`"horizontal" | "vertical"`): The orientation of the menu. - `value` (`string`, bindable): The value of the currently open menu item within the menu. Example: Basic Triggers open panels of links in a shared box below the bar; a top-level link uses navigationMenuTriggerStyle(). active marks the current page. ```svelte
Reports
    {#each reports as report (report.href)}
  • {report.title} {report.description}
  • {/each}
Projects Settings
```