Skip to content

React Navigation Menu

A glass React navigation menu whose items open rich dropdown panels, with hover intent, a panel that morphs between items, and full keyboard support.

npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/navigation-menu.json
Acme

Everything your team ships with

Analytics, automations and billing in one place.

  • NavigationMenu
  • NavigationMenuItem
  • NavigationMenuLink
  • NavigationMenuList
  • NavigationMenuContent
  • +4 more
  • +1 more

A site header with rich panels

Hover or focus Products: a featured card beside icon links. Move to Developers and the panel resizes while the content slides in from the side you came from.

Acme

Hover or focus a menu item: the panel resizes between Products and Developers and the content slides from the side you came from.

Files to copy

4 folders · 3 files · 4 packages
From theme/src/
  • components/navigation-menu/
  • components/status-icons/
  • lib/{cn.ts, popup-a11y.ts, popup-motion.ts}
  • styles/
shadcn CLI
npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/navigation-menu.jsonRegistry item: navigation-menu. The styles need the Tailwind v4 glass UI setup.
The examples also use
  • components/button/
  • components/spinner/
  • hooks/{use-latest.ts, use-magnetic.ts, use-media-query.ts, use-preferences.ts}
  • motion/{gate.ts, tokens.ts}
  • lib/{form.ts, state-light.tsx}
npx shadcn@latest add https://lokendra-builds.github.io/sheenui/r/button.json
Packages
pnpm add @base-ui/react clsx motion tailwind-merge
PropTypeDefaultDescription
delaynumber120How long to wait before opening the navigation popup. Specified in milliseconds.
closeDelaynumber150How long to wait before closing the navigation popup. Specified in milliseconds.
childrenReactNodeNoneNavigationMenuList and anything else that belongs in the nav.
popupClassNamestringNoneAdds extra classes to the shared dropdown panel.
sideOffsetnumber10Distance between the bar and the panel, in px.
value / defaultValuestring | nullNoneWhich item's panel is open (controlled / uncontrolled). Each item has a value.
onValueChange(value: string | null) => voidNoneCalled when the open item changes.
orientation"horizontal" | "vertical""horizontal"Sets the direction of arrow-key navigation.
aria-labelstringNoneNames the nav landmark.

Parts

PropTypeDefaultDescription
NavigationMenuListul propsNoneThe glass pill that holds the items; wraps on narrow screens.
NavigationMenuItemli props + value?NoneOne entry: a trigger with its content, or a link.
NavigationMenuTriggerbutton propsNoneOpens an item's panel; the chevron turns while it is open.
NavigationMenuContentdiv propsNoneWhat the panel shows for this item. Up to 36rem wide.
NavigationMenuLinka props + active?, plain?, closeOnClick?, render?NoneA link; plain skips the pill styling for use inside a panel; render swaps in a router link.
PropTypeDefaultDescription
plainbooleanfalseA block row with a hover tint instead of the bar's pill: for links inside a NavigationMenuContent panel.

Keyboard

KeysAction
TabEnters the bar; Tab again moves into an open panel's links and then out.
←/→Move between the items of the bar.
Enter/Space/↓Open the focused item's panel and move into it.
EscapeClose the panel and return focus to its trigger.

Accessibility

  • Renders a <nav> landmark: give it an aria-label ("Main", "Docs") so it is told apart from other navigation.
  • Triggers are buttons with aria-expanded and aria-controls; links use aria-current="page" when active.
  • The dropdown is not a menu role: it is a region of ordinary links, which is what site navigation should be.
  • Hover opens after delay (120 ms) and closes after closeDelay (150 ms); clicking and the keyboard open it at once, so touch and keyboard users never depend on hover.
  • On touch screens targets are 44px. Under reduced motion the panel fades and does not resize or slide.

When to use the navigation menu

  • Use it as a mega menu for a product site header where Products, Solutions and Resources each open a panel of titled links with short descriptions, the kind of mega-menu pattern that a flat list of links cannot carry.
  • Use it for a documentation site whose top bar groups guides, API reference and examples, so visitors can scan every section from one shared glass panel without leaving the current page.
  • The shared panel resizes to each item's content and slides between items, so it suits menus with panels of different sizes, from a three-link list to a grid up to 36rem wide.
  • Skip it when you only have a handful of plain links with no dropdowns; Horizontal nav is simpler and folds into a menu on narrow screens, while Menu is the right tool for action lists.
  • Pair it with Button for a call to action beside the bar, Badge for a New label inside a panel link, and Drawer to hold the navigation on phones.

Frequently asked questions

67 components pages in all: browse them on All components.

By Lokendra Singh Rathore (GitHub, opens in a new tab). Published , updated .