Component guideEditable source

Navigation Menu

Website navigation with links and optional expandable content.

Original component docs
On this page4 sectionsBack to top

Use Navigation Menu for navigation between pages. Put direct destinations in NavigationMenuLink and grouped destinations inside a trigger/content pair. Use Menubar for application commands.

Live preview
Loading preview...

#Installation

Complete the base setup. The CLI resolves dependencies. For manual installation:

npx shadcn@latest add @neobrutal-ui/navigation-menu

#Usage

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

export default function SiteNavigation() {
  return (
    <NavigationMenu aria-label="Main navigation">
      <NavigationMenuList>
        <NavigationMenuItem>
          <NavigationMenuLink active href="/docs" className={navigationMenuTriggerStyle()}>
            Documentation
          </NavigationMenuLink>
        </NavigationMenuItem>
        <NavigationMenuItem>
          <NavigationMenuLink href="/templates" className={navigationMenuTriggerStyle()}>
            Templates
          </NavigationMenuLink>
        </NavigationMenuItem>
      </NavigationMenuList>
    </NavigationMenu>
  );
}

#API reference

Prop / partPurposeDefault
NavigationMenu.value / onValueChangeControlled expanded itemUncontrolled
NavigationMenu.defaultValueInitially expanded itemnull
NavigationMenu.delay / closeDelayHover open and close delayBase UI defaults
NavigationMenu.orientationTrigger keyboard navigationhorizontal
NavigationMenuItem.valueStable grouped-item identifier when controlling stateOptional
NavigationMenuLink.href / renderNative destination or router-link compositionAnchor
NavigationMenuLink.activeUnderlines the current destination and sets aria-current="page"false

#Accessibility

Use real links and meaningful text. A trigger opens content rather than navigating. Preserve link props and refs when composing a router link. Mark the current destination and test keyboard and touch interactions. Provide a compact mobile layout rather than squeezing a wide desktop menu.

Expanded content scrolls within the available viewport height, so long link groups remain reachable in short windows and when zoomed in. Set active on the current page's link to keep it underlined while other links are hovered or focused.