---
title: "Navigation Menu"
description: "The top navigation of a site: links and triggers that open one shared panel of link cards, with nested and inline submenus."
url: https://gelatinui.com/components/navigation-menu
markdown_url: https://gelatinui.com/components/navigation-menu.md
access: free
install: "npx shadcn@latest add @gelatin-ui/navigation-menu"
registry_item: https://gelatinui.com/r/navigation-menu.json
version: "2026-11-08"
index: https://gelatinui.com/llms.txt
docs_index: https://gelatinui.com/docs/llms.txt
---

# Navigation Menu

> The top navigation of a site: links and triggers that open one shared panel of link cards, with nested and inline submenus.

Page: https://gelatinui.com/components/navigation-menu

## When to use it

Best for: The top navigation of a site: links, and triggers that open one shared panel of links.

- Put a `NavigationMenuList` in it, with one `NavigationMenuItem` for each entry.
- Give a panel a width, because it is as wide as its content.
- Pass `render` on `NavigationMenuLink` for a router link.

## When not to use it

- For the nav of an app, use a [Sidebar](https://gelatinui.com/components/sidebar.md).
- For a list of actions, use a [Menu](https://gelatinui.com/components/menu.md).

## Notes for agents

- Each item with a panel needs a `value`.
- `value` and `onValueChange` control the open item, and `null` is closed.
- Set `popup={false}` only to place the popup yourself.
- A phone has no room for it: move the links into a Drawer, as `navbar-01` does.

## Anatomy

```text
NavigationMenu
├─ NavigationMenuList (0..n)
├─ NavigationMenuItem (0..n)
├─ NavigationMenuIndicator (0..n)
├─ NavigationMenuTrigger (0..n)
├─ NavigationMenuContent (0..n)
├─ NavigationMenuLink (0..n)
├─ NavigationMenuPositioner (0..n)
└─ NavigationMenuViewport (0..n)
```

## API reference

### NavigationMenu

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |
| `popup` | `boolean` | true | Render the popup after the children (default true, as in shadcn). Set `false` to place a `NavigationMenuPositioner` yourself, or for an inline nested submenu that shows its content in a `NavigationMenuViewport`. |
| `popupProps` | `NavigationMenuPositionerProps` |  | The props of the popup it renders: the positioner props, `arrow`, `backdrop`, and the parts. |

Also takes every prop of Base UI `NavigationMenu.Root`: https://base-ui.com/react/components/navigation-menu

### NavigationMenuList

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |

### NavigationMenuItem

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |

Also takes every prop of Base UI `NavigationMenu.Item`: https://base-ui.com/react/components/navigation-menu

### NavigationMenuIndicator

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |

### NavigationMenuTrigger

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |
| `indicatorProps` | `NavigationMenuIndicatorProps` |  | The props of its `NavigationMenuIndicator` (the chevron). |

Also takes every prop of Base UI `NavigationMenu.Trigger`: https://base-ui.com/react/components/navigation-menu

### NavigationMenuContent

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |

Also takes every prop of Base UI `NavigationMenu.Content`: https://base-ui.com/react/components/navigation-menu

### NavigationMenuLink

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `variant` | `"card" \| "top"` | "card" |  |
| `className` | `string` |  |  |

Also takes every prop of Base UI `NavigationMenu.Link`: https://base-ui.com/react/components/navigation-menu

### NavigationMenuPositioner

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |
| `arrow` | `boolean` | false | Show an arrow that points at the trigger. The gap grows from 4px to 8px. |
| `backdrop` | `boolean` | false | Put a clear layer under the popup (Base UI `NavigationMenu.Backdrop`), for example to dim it. |
| `portalProps` | `Omit` |  | Other Base UI props of the inner parts. A `className` here adds to the component classes. |
| `positionerProps` | `PopupPartProps` |  |  |
| `backdropProps` | `PopupPartProps` |  |  |
| `arrowProps` | `PopupPartProps<NavigationMenuArrowProps>` |  |  |
| `viewportProps` | `PopupPartProps` |  |  |

Also takes every prop of Base UI `NavigationMenu.Portal`: https://base-ui.com/react/components/navigation-menu

### NavigationMenuViewport

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |

## Styling

| Part | Slot | States | CSS variables | Tokens |
| --- | --- | --- | --- | --- |
| NavigationMenu | `navigation-menu` |  |  |  |
| NavigationMenuList | `navigation-menu-list` |  |  |  |
| NavigationMenuItem | `navigation-menu-item` | `data-disabled` |  |  |
| NavigationMenuIndicator | `navigation-menu-indicator` |  |  |  |
| NavigationMenuTrigger | `navigation-menu-trigger` |  |  |  |
| NavigationMenuContent | `navigation-menu-content` | `data-activation-direction`, `data-ending-style`, `data-starting-style` | `--available-height`, `--available-width`, `--motion-ease-out`, `--motion-ease-panel`, `--motion-fade`, `--motion-panel` | `motion-timing` |
| NavigationMenuLink | `navigation-menu-link` | `data-active` |  |  |
| NavigationMenuPositioner | `navigation-menu-positioner` | `data-ending-style`, `data-instant`, `data-side` | `--available-height`, `--available-width`, `--motion-ease-out`, `--motion-ease-panel`, `--motion-panel`, `--motion-popup`, `--motion-popup-exit`, `--popup-height`, `--popup-width` | `motion-timing` |
| NavigationMenuViewport | `navigation-menu-viewport` |  |  |  |

## Usage

Compose the list, the triggers, and the panels.

```tsx title="site-nav.tsx"
import {
  NavigationMenu,
  NavigationMenuContent,
  NavigationMenuItem,
  NavigationMenuLink,
  NavigationMenuList,
  NavigationMenuTrigger,
} from "@/components/ui/navigation-menu";

export function SiteNav() {
  return (
    <NavigationMenu>
      <NavigationMenuList>
        <NavigationMenuItem value="resources">
          <NavigationMenuTrigger>Resources</NavigationMenuTrigger>
          <NavigationMenuContent>
            <NavigationMenuLink variant="card" href="/docs">
              Docs
            </NavigationMenuLink>
          </NavigationMenuContent>
        </NavigationMenuItem>
      </NavigationMenuList>
    </NavigationMenu>
  );
}
```

## Compose

Rules:

- Touch targets (`touch-targets`): Give every control a hit area of at least 44 px on touch screens, even when it looks smaller.
- Compose the parts (`compose-parts`): Build each item from its named parts as children, and pass your text and icons in as parts.
- Every state is designed (`every-state`): Give each view of data its loading, empty, and error states: a skeleton in the final layout, an `Empty` with an illustration and one next action, and an error that says what failed and how to retry.

## Add it

```bash
npx shadcn@latest add @gelatin-ui/navigation-menu
```

It adds 28 registry items: 25 files, 4411 lines, and the npm packages `@base-ui/react`, `clsx`, `motion`, `tailwind-merge`, `tailwind-variants`.

## Built on

- [Button](https://gelatinui.com/components/button.md)
- [Collapsible](https://gelatinui.com/components/collapsible.md)

## For AI agents

- Every item, one file: https://gelatinui.com/llms.txt
- MCP server (`search_items`, `get_item`, `get_install_plan`): https://gelatinui.com/mcp

## Related

- [Menu](https://gelatinui.com/components/menu.md)
- [Sidebar](https://gelatinui.com/components/sidebar.md)

## Keyboard

| Keys | Action |
| --- | --- |
| Tab | Moves through the triggers, the top links, and the open panel. |
| ← → | Moves along the list. |
| Enter, Space, ↓ | Opens a panel. In a vertical menu, use → in place of ↓. |
| Esc | Closes the panel. |

## Accessibility

It renders a `nav`. Base UI sets the expanded state on each trigger.

`active` on a link marks the current page with `aria-current`.

## Motion

| Part | Motion |
| --- | --- |
| Panel | panel · ease-panel · the shared popup moves and resizes between triggers |
