Navigation Menu
A horizontal navigation bar with click-triggered link panels.
Installation
pnpm dlx nachui add navigation-menuAnatomy
Composition
Use the following composition to build a
NavigationMenu:The root renders a
<nav> and lays its children out in a row, so plain anchors
and router links live side by side with dropdown items. Each Item owns its
open state: it opens on click, never on hover, so panels only show up when
the reader asks for them, and it closes on Escape, on an outside click, or
after following a link. The panel carries a small caret pointing back at the
trigger that opened it.Router links
NavigationMenu.Link renders an <a> by default. To keep client-side
navigation (or locale-aware routing), pass asChild with your framework's
Link as the only child — the row content is injected into it and the menu
still closes after navigating:Variants
With badges
Rows accept a
badge slot next to the title — and anything else you drop into
Content renders as-is, like this non-interactive "coming soon" row:API Reference
NavigationMenu
Renders a
<nav> element. Accepts every HTMLElement attribute.| Prop | Type | Default | Description |
|---|---|---|---|
className | string | - | Additional CSS classes |
NavigationMenu.Item
Wraps one trigger + panel pair and owns its open state.
| Prop | Type | Default | Description |
|---|---|---|---|
className | string | - | Additional CSS classes |
NavigationMenu.Trigger
A button with a chevron that rotates while the panel is open.
| Prop | Type | Default | Description |
|---|---|---|---|
className | string | - | Additional CSS classes |
NavigationMenu.Content
The floating panel, anchored below the item and animated on open/close.
| Prop | Type | Default | Description |
|---|---|---|---|
className | string | - | Additional CSS classes |
NavigationMenu.Link
| Prop | Type | Default | Description |
|---|---|---|---|
title | string | - | Row title (required) |
description | string | - | Muted single-line description |
icon | React.ReactNode | - | Rendered inside the leading icon box |
badge | React.ReactNode | - | Rendered next to the title |
asChild | boolean | false | Inject the row into a child routing <Link> |
href | string | - | Anchor target when not using asChild |
className | string | - | Additional CSS classes |
Found something to improve?
Notice a bug, typo, or missing detail on this page? Help us make the documentation better by opening a GitHub issue.