# Navigation Menu

> Show a site's main sections as links, with panels that preview the pages under each section.

Source: https://www.honestui.com/docs/components/navigation-menu

```tsx
"use client"

import {
  NavigationMenu,
  NavigationMenuContent,
  NavigationMenuItem,
  NavigationMenuLink,
  NavigationMenuLinkDescription,
  NavigationMenuLinkTitle,
  NavigationMenuList,
  NavigationMenuTrigger,
} from "@/components/honest-ui/ui/navigation-menu"

const productLinks = [
  {
    href: "/docs/component-guide",
    title: "Components",
    description: "Accessible building blocks you copy into your project.",
  },
  {
    href: "/docs/charts",
    title: "Charts",
    description: "Line, bar, area, and pie charts on theme tokens.",
  },
  {
    href: "/docs/animated",
    title: "Animated",
    description: "Motion that respects reduced-motion preferences.",
  },
  {
    href: "/docs/shaders",
    title: "Shaders",
    description: "WebGL backgrounds with static fallbacks.",
  },
] as const

const resourceLinks = [
  {
    href: "/docs/get-started",
    title: "Get started",
    description: "Install the CLI and add your first component.",
  },
  {
    href: "/docs/accessibility",
    title: "Accessibility",
    description: "How every component handles focus, roles, and labels.",
  },
  {
    href: "/docs/changelog",
    title: "Changelog",
    description: "What changed in each release.",
  },
] as const

export function NavigationMenuDemo() {
  return (
    <NavigationMenu>
      <NavigationMenuList>
        <NavigationMenuItem>
          <NavigationMenuTrigger>Product</NavigationMenuTrigger>
          <NavigationMenuContent>
            <ul className="m-0 grid list-none gap-[var(--hui-space-1)] p-0 sm:w-[30rem] sm:grid-cols-2">
              {productLinks.map((link) => (
                <li key={link.href}>
                  <NavigationMenuLink href={link.href}>
                    <NavigationMenuLinkTitle>{link.title}</NavigationMenuLinkTitle>
                    <NavigationMenuLinkDescription>{link.description}</NavigationMenuLinkDescription>
                  </NavigationMenuLink>
                </li>
              ))}
            </ul>
          </NavigationMenuContent>
        </NavigationMenuItem>
        <NavigationMenuItem>
          <NavigationMenuTrigger>Resources</NavigationMenuTrigger>
          <NavigationMenuContent>
            <ul className="m-0 grid list-none gap-[var(--hui-space-1)] p-0 sm:w-[20rem]">
              {resourceLinks.map((link) => (
                <li key={link.href}>
                  <NavigationMenuLink href={link.href}>
                    <NavigationMenuLinkTitle>{link.title}</NavigationMenuLinkTitle>
                    <NavigationMenuLinkDescription>{link.description}</NavigationMenuLinkDescription>
                  </NavigationMenuLink>
                </li>
              ))}
            </ul>
          </NavigationMenuContent>
        </NavigationMenuItem>
        <NavigationMenuItem>
          <NavigationMenuLink variant="trigger" href="/docs/examples">
            Examples
          </NavigationMenuLink>
        </NavigationMenuItem>
      </NavigationMenuList>
    </NavigationMenu>
  )
}

```

## Overview [#overview]

Use Navigation Menu for the primary navigation of a website or docs site: a short row of sections where some open a panel of links and others go straight to a page. Panels can hold a short list, a grid with descriptions, or a featured card next to secondary links.

Every destination is a real link, so people can middle-click, copy the address, or open it in a new tab. For application commands such as Save or Export, use [Menubar](/docs/components/menubar) or [Menu](/docs/components/menu) instead.

## Anatomy [#anatomy]

`NavigationMenu` wraps a `NavigationMenuList` of `NavigationMenuItem`s. An item holds either a `NavigationMenuTrigger` with its `NavigationMenuContent`, or a single `NavigationMenuLink` with `variant="trigger"` that looks like a trigger but navigates. Inside content, `NavigationMenuLink` renders a padded row; add `NavigationMenuLinkTitle` and `NavigationMenuLinkDescription` for the title-and-summary layout.

All items share one popup. The root renders it for you through `NavigationMenuPositioner`, which places a single surface under the active trigger and animates its width and height as people move between items. The content slides in from the side of the previously open trigger, and reduced-motion preferences keep only the fade.

## Accessibility [#accessibility]

The root renders a `nav` landmark. Give it an `aria-label` when a page has more than one navigation region. Triggers are buttons with `aria-expanded`, and their content is linked with `aria-controls`. Tab moves through triggers and links in order. Enter, Space, or Down Arrow opens a panel and the next Tab moves into it. Escape closes the panel and returns focus to the trigger.

Panels open on hover after a short delay and close after a matching delay, so moving diagonally into the popup doesn't close it. A transparent bridge covers the gap between trigger and popup. Mark the current page with `active` on its link; Base UI sets `aria-current="page"` and the link gets the same tint as hover, so the state never depends on color alone.

## Installation [#installation]


  

  
    <CliBlock commands="[&#x22;navigation-menu&#x22;]" />
  

  
    
      
        Install the required dependencies:
      

      ```bash
      npm install @base-ui/react class-variance-authority
      ```

      
        Copy and paste the component into your project.
      

      ### components/ui/navigation-menu.tsx

```tsx
"use client"

import * as React from "react"
import { NavigationMenu as NavigationMenuPrimitive } from "@base-ui/react/navigation-menu"
import { cva } from "class-variance-authority"
import { ChevronDown as ChevronDownIcon } from "honestui/icons"

import { cn } from "@/lib/utils"

// Top-level triggers and plain links share one quiet, link-button look so a
// row that mixes menus and direct links reads as one set of peers.
const navigationMenuTriggerStyle = cva(
  "relative inline-flex min-h-[var(--hui-density-control-height,36px)] w-max shrink-0 cursor-pointer items-center justify-center gap-[var(--hui-space-2)] rounded-[var(--hui-radius-2)] border-0 bg-transparent px-[var(--hui-space-4)] text-[var(--hui-color-foreground-base-primary)] no-underline outline-none select-none [font-size:var(--hui-font-size-control,13px)] [font-weight:var(--hui-font-weight-medium)] [letter-spacing:var(--hui-letter-spacing-control,-0.003em)] [line-height:var(--hui-line-height-control,16px)] motion-safe:[transition:var(--hui-transition-interactive)] hover:bg-[var(--hui-color-background-base-primary-hover)] data-popup-open:bg-[var(--hui-color-background-base-primary-hover)] data-active:bg-[var(--hui-color-background-neutral-secondary)] focus-visible:[outline:var(--hui-focus-ring)] focus-visible:outline-offset-[var(--hui-focus-ring-offset-accent)] data-disabled:cursor-not-allowed data-disabled:text-[var(--hui-color-foreground-base-tertiary)] forced-colors:data-popup-open:outline forced-colors:data-popup-open:outline-1 forced-colors:data-popup-open:outline-[Highlight] pointer-coarse:after:pointer-events-none pointer-coarse:after:absolute pointer-coarse:after:inset-x-0 pointer-coarse:after:top-1/2 pointer-coarse:after:min-h-11 pointer-coarse:after:-translate-y-1/2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4"
)

function NavigationMenu({
  className,
  children,
  viewport = true,
  ...props
}: NavigationMenuPrimitive.Root.Props & {
  /**
   * Render the shared popup and viewport that hold every item's content.
   * Turn it off to compose `NavigationMenuPositioner` yourself.
   */
  viewport?: boolean
}) {
  return (
    <NavigationMenuPrimitive.Root
      data-slot="navigation-menu"
      className={cn("relative w-max max-w-full text-[var(--hui-color-foreground-base-primary)]", className)}
      {...props}
    >
      {children}
      {viewport && <NavigationMenuPositioner />}
    </NavigationMenuPrimitive.Root>
  )
}

function NavigationMenuList({ className, ...props }: NavigationMenuPrimitive.List.Props) {
  return (
    <NavigationMenuPrimitive.List
      data-slot="navigation-menu-list"
      className={cn(
        "relative m-0 flex list-none items-center gap-[var(--hui-space-1)] p-0 in-data-[orientation=vertical]:flex-col in-data-[orientation=vertical]:items-stretch",
        className
      )}
      {...props}
    />
  )
}

function NavigationMenuItem({ className, ...props }: NavigationMenuPrimitive.Item.Props) {
  return (
    <NavigationMenuPrimitive.Item
      data-slot="navigation-menu-item"
      className={cn("relative", className)}
      {...props}
    />
  )
}

function NavigationMenuTrigger({
  className,
  children,
  ...props
}: NavigationMenuPrimitive.Trigger.Props) {
  return (
    <NavigationMenuPrimitive.Trigger
      data-slot="navigation-menu-trigger"
      className={cn(navigationMenuTriggerStyle(), "pe-[var(--hui-space-3)]", className)}
      {...props}
    >
      {children}
      <NavigationMenuPrimitive.Icon
        data-slot="navigation-menu-icon"
        className="inline-flex text-[var(--hui-color-foreground-base-secondary)] motion-safe:[transition:rotate_var(--hui-duration-fast)_var(--hui-ease-out)] data-popup-open:rotate-180"
      >
        <ChevronDownIcon aria-hidden="true" className="size-3.5" />
      </NavigationMenuPrimitive.Icon>
    </NavigationMenuPrimitive.Trigger>
  )
}

// Content slides in from the side of the previously open trigger, so moving
// along the row reads as one panel changing. Reduced motion keeps the fade.
function NavigationMenuContent({ className, ...props }: NavigationMenuPrimitive.Content.Props) {
  return (
    <NavigationMenuPrimitive.Content
      data-slot="navigation-menu-content"
      className={cn(
        "h-full w-[calc(100vw-var(--hui-space-8))] p-[var(--hui-space-2)] sm:w-max [transition:opacity_var(--hui-duration-normal)_var(--hui-ease-out)] data-ending-style:opacity-0 data-starting-style:opacity-0 motion-safe:[transition:opacity_var(--hui-duration-normal)_var(--hui-ease-out),translate_var(--hui-duration-normal)_var(--hui-ease-out)] motion-safe:data-starting-style:data-[activation-direction=left]:-translate-x-1/4 motion-safe:data-starting-style:data-[activation-direction=right]:translate-x-1/4 motion-safe:data-ending-style:data-[activation-direction=left]:translate-x-1/4 motion-safe:data-ending-style:data-[activation-direction=right]:-translate-x-1/4",
        className
      )}
      {...props}
    />
  )
}

// The positioner and popup animate their size between items through the
// --positioner-* and --popup-* variables Base UI measures from the content.
function NavigationMenuPositioner({
  className,
  sideOffset = 8,
  align = "start",
  collisionPadding = { top: 8, bottom: 8, left: 16, right: 16 },
  ...props
}: NavigationMenuPrimitive.Positioner.Props) {
  return (
    <NavigationMenuPrimitive.Portal>
      <NavigationMenuPrimitive.Positioner
        data-slot="navigation-menu-positioner"
        sideOffset={sideOffset}
        align={align}
        collisionPadding={collisionPadding}
        collisionAvoidance={{ side: "none" }}
        className={cn(
          // A transparent bridge over the side offset keeps the menu open
          // while the pointer travels from a trigger into the popup.
          "z-[var(--hui-z-index-portal)] h-(--positioner-height) w-(--positioner-width) max-w-(--available-width) before:absolute before:content-[''] data-[side=bottom]:before:inset-x-0 data-[side=bottom]:before:-top-2 data-[side=bottom]:before:h-2 data-[side=top]:before:inset-x-0 data-[side=top]:before:-bottom-2 data-[side=top]:before:h-2 data-[side=left]:before:inset-y-0 data-[side=left]:before:-right-2 data-[side=left]:before:w-2 data-[side=right]:before:inset-y-0 data-[side=right]:before:-left-2 data-[side=right]:before:w-2 motion-safe:[transition:top_var(--hui-duration-normal)_var(--hui-ease-out),left_var(--hui-duration-normal)_var(--hui-ease-out),right_var(--hui-duration-normal)_var(--hui-ease-out),bottom_var(--hui-duration-normal)_var(--hui-ease-out)] data-instant:transition-none",
          className
        )}
        {...props}
      >
        <NavigationMenuPrimitive.Popup
          data-slot="navigation-menu-popup"
          className="relative h-(--popup-height) w-(--popup-width) origin-(--transform-origin) overflow-hidden rounded-[var(--hui-radius-3)] border-[0.5px] border-[var(--hui-color-border-overlay)] bg-[var(--hui-color-background-overlay)] text-[var(--hui-color-foreground-base-primary)] shadow-[var(--hui-shadow-overlay,var(--hui-shadow-soft))] outline-none [transition:opacity_var(--hui-duration-fast)_var(--hui-ease-out)] data-ending-style:opacity-0 data-starting-style:opacity-0 motion-safe:[transition:opacity_var(--hui-duration-fast)_var(--hui-ease-out),scale_var(--hui-duration-fast)_var(--hui-ease-out),width_var(--hui-duration-normal)_var(--hui-ease-out),height_var(--hui-duration-normal)_var(--hui-ease-out)] motion-safe:data-ending-style:scale-[0.97] motion-safe:data-starting-style:scale-[0.97] forced-colors:border-[CanvasText]"
        >
          <NavigationMenuPrimitive.Viewport
            data-slot="navigation-menu-viewport"
            className="relative size-full overflow-hidden"
          />
        </NavigationMenuPrimitive.Popup>
      </NavigationMenuPrimitive.Positioner>
    </NavigationMenuPrimitive.Portal>
  )
}

// Base UI sets aria-current="page" when `active` is true; the tint mirrors
// that state for sighted users. `variant="trigger"` renders a top-level link
// that sits in the list beside menu triggers.
function NavigationMenuLink({
  className,
  variant = "panel",
  ...props
}: NavigationMenuPrimitive.Link.Props & {
  variant?: "panel" | "trigger"
}) {
  return (
    <NavigationMenuPrimitive.Link
      data-slot="navigation-menu-link"
      data-variant={variant}
      className={cn(
        variant === "trigger"
          ? navigationMenuTriggerStyle()
          : "flex flex-col gap-[var(--hui-space-1)] rounded-[var(--hui-radius-2)] p-[var(--hui-space-3)] text-[var(--hui-color-foreground-base-primary)] no-underline outline-none [font-size:var(--hui-font-size-control,13px)] [line-height:var(--hui-line-height-control,16px)] motion-safe:[transition:var(--hui-transition-interactive)] hover:bg-[var(--hui-color-background-overlay-hover)] data-active:bg-[var(--hui-color-background-overlay-hover)] focus-visible:[outline:var(--hui-focus-ring)] focus-visible:outline-offset-[-2px] [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg]:text-[var(--hui-color-foreground-base-secondary)] [&_svg:not([class*='size-'])]:size-4",
        className
      )}
      {...props}
    />
  )
}

function NavigationMenuLinkTitle({ className, ...props }: React.ComponentProps<"span">) {
  return (
    <span
      data-slot="navigation-menu-link-title"
      className={cn(
        "flex items-center gap-[var(--hui-space-2)] [font-weight:var(--hui-font-weight-medium)] text-[var(--hui-color-foreground-base-primary)]",
        className
      )}
      {...props}
    />
  )
}

function NavigationMenuLinkDescription({ className, ...props }: React.ComponentProps<"span">) {
  return (
    <span
      data-slot="navigation-menu-link-description"
      className={cn(
        "line-clamp-2 text-[var(--hui-color-foreground-base-secondary)] [font-size:var(--hui-font-size-small)] [letter-spacing:var(--hui-letter-spacing-small)] [line-height:var(--hui-line-height-small)]",
        className
      )}
      {...props}
    />
  )
}

export {
  NavigationMenu,
  NavigationMenuList,
  NavigationMenuItem,
  NavigationMenuTrigger,
  NavigationMenuContent,
  NavigationMenuPositioner,
  NavigationMenuPositioner as NavigationMenuViewport,
  NavigationMenuLink,
  NavigationMenuLinkTitle,
  NavigationMenuLinkDescription,
  navigationMenuTriggerStyle,
}

```

      
        Update the import paths to match your project setup.
      
    
  


## Usage [#usage]

```tsx
import {
  NavigationMenu,
  NavigationMenuContent,
  NavigationMenuItem,
  NavigationMenuLink,
  NavigationMenuLinkDescription,
  NavigationMenuLinkTitle,
  NavigationMenuList,
  NavigationMenuTrigger,
} from "@/components/ui/navigation-menu"
```

```tsx
<NavigationMenu>
  <NavigationMenuList>
    <NavigationMenuItem>
      <NavigationMenuTrigger>Product</NavigationMenuTrigger>
      <NavigationMenuContent>
        <NavigationMenuLink href="/docs/charts">
          <NavigationMenuLinkTitle>Charts</NavigationMenuLinkTitle>
          <NavigationMenuLinkDescription>Line, bar, and area charts.</NavigationMenuLinkDescription>
        </NavigationMenuLink>
      </NavigationMenuContent>
    </NavigationMenuItem>
    <NavigationMenuItem>
      <NavigationMenuLink variant="trigger" href="/pricing">
        Pricing
      </NavigationMenuLink>
    </NavigationMenuItem>
  </NavigationMenuList>
</NavigationMenu>
```

For client-side routing, pass your framework's link through `render`:

```tsx
<NavigationMenuLink render={<NextLink href="/docs/charts" />}>Charts</NavigationMenuLink>
```

## Don't do this [#dont-do-this]

### A trigger that is also a page [#a-trigger-that-is-also-a-page]

```tsx
// Bad
<NavigationMenuTrigger onClick={() => router.push("/product")}>Product</NavigationMenuTrigger>
```

```tsx
// Good
<NavigationMenuContent>
  <NavigationMenuLink href="/product">Product overview</NavigationMenuLink>
  ...
</NavigationMenuContent>
```

A trigger opens a panel; if clicking it also navigates, keyboard and touch users lose the panel and nobody can predict which one happens. Put the overview page inside the panel as its first link.

### Every link in a panel [#every-link-in-a-panel]

Long menus with dozens of links are hard to scan and slow to move through by keyboard. Keep each panel to a handful of destinations and link to an index page for the rest.

## Examples [#examples]

### Grid and list panels [#grid-and-list-panels]

A two-column product grid, a resource list, and a plain link in the same row.

```tsx
"use client"

import {
  NavigationMenu,
  NavigationMenuContent,
  NavigationMenuItem,
  NavigationMenuLink,
  NavigationMenuLinkDescription,
  NavigationMenuLinkTitle,
  NavigationMenuList,
  NavigationMenuTrigger,
} from "@/components/honest-ui/ui/navigation-menu"

const productLinks = [
  {
    href: "/docs/component-guide",
    title: "Components",
    description: "Accessible building blocks you copy into your project.",
  },
  {
    href: "/docs/charts",
    title: "Charts",
    description: "Line, bar, area, and pie charts on theme tokens.",
  },
  {
    href: "/docs/animated",
    title: "Animated",
    description: "Motion that respects reduced-motion preferences.",
  },
  {
    href: "/docs/shaders",
    title: "Shaders",
    description: "WebGL backgrounds with static fallbacks.",
  },
] as const

const resourceLinks = [
  {
    href: "/docs/get-started",
    title: "Get started",
    description: "Install the CLI and add your first component.",
  },
  {
    href: "/docs/accessibility",
    title: "Accessibility",
    description: "How every component handles focus, roles, and labels.",
  },
  {
    href: "/docs/changelog",
    title: "Changelog",
    description: "What changed in each release.",
  },
] as const

export function NavigationMenuDemo() {
  return (
    <NavigationMenu>
      <NavigationMenuList>
        <NavigationMenuItem>
          <NavigationMenuTrigger>Product</NavigationMenuTrigger>
          <NavigationMenuContent>
            <ul className="m-0 grid list-none gap-[var(--hui-space-1)] p-0 sm:w-[30rem] sm:grid-cols-2">
              {productLinks.map((link) => (
                <li key={link.href}>
                  <NavigationMenuLink href={link.href}>
                    <NavigationMenuLinkTitle>{link.title}</NavigationMenuLinkTitle>
                    <NavigationMenuLinkDescription>{link.description}</NavigationMenuLinkDescription>
                  </NavigationMenuLink>
                </li>
              ))}
            </ul>
          </NavigationMenuContent>
        </NavigationMenuItem>
        <NavigationMenuItem>
          <NavigationMenuTrigger>Resources</NavigationMenuTrigger>
          <NavigationMenuContent>
            <ul className="m-0 grid list-none gap-[var(--hui-space-1)] p-0 sm:w-[20rem]">
              {resourceLinks.map((link) => (
                <li key={link.href}>
                  <NavigationMenuLink href={link.href}>
                    <NavigationMenuLinkTitle>{link.title}</NavigationMenuLinkTitle>
                    <NavigationMenuLinkDescription>{link.description}</NavigationMenuLinkDescription>
                  </NavigationMenuLink>
                </li>
              ))}
            </ul>
          </NavigationMenuContent>
        </NavigationMenuItem>
        <NavigationMenuItem>
          <NavigationMenuLink variant="trigger" href="/docs/examples">
            Examples
          </NavigationMenuLink>
        </NavigationMenuItem>
      </NavigationMenuList>
    </NavigationMenu>
  )
}

```

### Featured card with icons [#featured-card-with-icons]

A larger lead link next to secondary links with icons. The card is still one link with one accessible name.

```tsx
"use client"

import {
  BookOpen as BookOpenIcon,
  Code as CodeIcon,
  LayoutGrid as LayoutGridIcon,
  Palette as PaletteIcon,
  Terminal as TerminalIcon,
} from "honestui/icons"

import {
  NavigationMenu,
  NavigationMenuContent,
  NavigationMenuItem,
  NavigationMenuLink,
  NavigationMenuLinkDescription,
  NavigationMenuLinkTitle,
  NavigationMenuList,
  NavigationMenuTrigger,
} from "@/components/honest-ui/ui/navigation-menu"

const guides = [
  {
    href: "/docs/get-started",
    title: "Installation",
    description: "Set up the CLI in an existing React project.",
    icon: TerminalIcon,
  },
  {
    href: "/docs/theme/overview",
    title: "Theming",
    description: "Change color, radius, and type with tokens.",
    icon: PaletteIcon,
  },
  {
    href: "/docs/developers",
    title: "Developers",
    description: "Registry, MCP server, and package exports.",
    icon: CodeIcon,
  },
] as const

export function NavigationMenuFeatured() {
  return (
    <NavigationMenu>
      <NavigationMenuList>
        <NavigationMenuItem>
          <NavigationMenuTrigger>Docs</NavigationMenuTrigger>
          <NavigationMenuContent>
            <div className="grid gap-[var(--hui-space-2)] sm:w-[34rem] sm:grid-cols-[13rem_1fr]">
              {/* The featured card is still a single link with one accessible name. */}
              <NavigationMenuLink
                href="/docs/component-guide"
                className="justify-end gap-[var(--hui-space-2)] bg-[var(--hui-color-background-base-secondary)] p-[var(--hui-space-5)] sm:min-h-48"
              >
                <LayoutGridIcon className="size-5" />
                <NavigationMenuLinkTitle className="[font-size:var(--hui-font-size-regular)]">
                  Component guide
                </NavigationMenuLinkTitle>
                <NavigationMenuLinkDescription className="line-clamp-3">
                  Choose the right component for each job, with guidance on states and accessibility.
                </NavigationMenuLinkDescription>
              </NavigationMenuLink>
              <ul className="m-0 grid list-none gap-[var(--hui-space-1)] p-0">
                {guides.map(({ icon: Icon, ...link }) => (
                  <li key={link.href}>
                    <NavigationMenuLink href={link.href}>
                      <NavigationMenuLinkTitle>
                        <Icon aria-hidden="true" />
                        {link.title}
                      </NavigationMenuLinkTitle>
                      <NavigationMenuLinkDescription className="ps-6">
                        {link.description}
                      </NavigationMenuLinkDescription>
                    </NavigationMenuLink>
                  </li>
                ))}
              </ul>
            </div>
          </NavigationMenuContent>
        </NavigationMenuItem>
        <NavigationMenuItem>
          <NavigationMenuLink variant="trigger" href="/docs/accessibility">
            <BookOpenIcon aria-hidden="true" />
            Accessibility
          </NavigationMenuLink>
        </NavigationMenuItem>
      </NavigationMenuList>
    </NavigationMenu>
  )
}

```

### Current page [#current-page]

Links only, with `viewport={false}` because nothing opens. The `active` link carries `aria-current="page"`.

```tsx
"use client"

import {
  NavigationMenu,
  NavigationMenuItem,
  NavigationMenuLink,
  NavigationMenuList,
} from "@/components/honest-ui/ui/navigation-menu"

const links = [
  { href: "/docs/component-guide", label: "Components" },
  { href: "/docs/charts", label: "Charts" },
  { href: "/docs/shaders", label: "Shaders" },
  { href: "/docs/icons", label: "Icons" },
] as const

// In an app, compare each href against the router's current pathname.
const currentPath = "/docs/charts"

export function NavigationMenuActiveLink() {
  return (
    <NavigationMenu viewport={false} aria-label="Library sections">
      <NavigationMenuList>
        {links.map((link) => (
          <NavigationMenuItem key={link.href}>
            <NavigationMenuLink
              variant="trigger"
              href={link.href}
              active={link.href === currentPath}
            >
              {link.label}
            </NavigationMenuLink>
          </NavigationMenuItem>
        ))}
      </NavigationMenuList>
    </NavigationMenu>
  )
}

```

## API reference [#api-reference]

`NavigationMenu` accepts all Base UI Navigation Menu root props plus Honest UI's `viewport`:

| Prop                     | Values                   | Default      |
| ------------------------ | ------------------------ | ------------ |
| `viewport`               | boolean                  | `true`       |
| `value` / `defaultValue` | item value or `null`     | `null`       |
| `orientation`            | `horizontal`, `vertical` | `horizontal` |
| `delay` / `closeDelay`   | number (ms)              | `50` / `50`  |

`NavigationMenuLink` accepts Base UI Link props, including `active`, `closeOnClick`, and `render`, plus `variant` (`panel` or `trigger`, default `panel`). `NavigationMenuPositioner` (also exported as `NavigationMenuViewport`) accepts Positioner props and defaults to `align="start"` and `sideOffset={8}`; render it yourself with `viewport={false}` to change placement. `navigationMenuTriggerStyle()` returns the trigger classes for custom elements.

See the [Base UI Navigation Menu API](https://base-ui.com/react/components/navigation-menu#api-reference) for the full list.
