Ballmac UI home

Navigation Menu

A site navigation bar with flyout panels sharing one animated viewport that resizes to its content, with keyboard and pointer intent handling, built on Radix.

Installation

$ pnpm dlx shadcn@latest add @ballmac/navigation-menu

Usage

import { NavigationMenu, NavigationMenuList, NavigationMenuItem, NavigationMenuContent, NavigationMenuTrigger, NavigationMenuLink, NavigationMenuIndicator, NavigationMenuViewport, navigationMenuTriggerStyle } from "@/components/ballmac/navigation-menu"

The full example is in the Code tab above.

Examples

API reference

<NavigationMenu>

PropTypeDefault
viewport

Render panels in a shared viewport that resizes between items. Turn off to position each panel under its trigger.

booleantrue
viewportAlign

Where the shared viewport sits under the menu: from its left edge, or centered under the whole menu (good for wide mega menus).

"start" | "center""start"

<NavigationMenuViewport>

PropTypeDefault
align

Align the viewport to the menu's left edge or center it under the menu.

"start" | "center""start"

<NavigationMenuLink>

PropTypeDefault
topLevel

Style the link like a top-level trigger (for links placed directly in the bar, such as Pricing). Server components can use this instead of calling `navigationMenuTriggerStyle`.

booleanfalse

Also accepts the standard attributes of its root element.

Accessibility

KeyAction
Enter / Space / ArrowDownOpens the focused panel
TabMoves into the panel links
ArrowLeft / ArrowRightMoves between top-level items
EscapeCloses the panel

Use with AI

Top-level triggers open content panels of links. Use navigationMenuTriggerStyle for plain top-level links. With the shadcn MCP server set up (guide), ask your agent:

Add the Ballmac UI Navigation Menu (@ballmac/navigation-menu) to this project with the shadcn MCP, then use it where it fits.

Use it for

  • Marketing site headers
  • Docs navigation with grouped links

Not for

  • An application command menu; use menubar
  • A small overflow list; use dropdown-menu

Registry JSON: https://ui.ballmac.com/r/navigation-menu.json

Credits

Based on shadcn/ui Navigation Menu, adapted by Ballmac. Free to use in personal and commercial projects.