Hulian UIv0.93.5413 components0 components
  • Start
  • Components
  • Blocks
  • Pages
  • Demos
  • Changelog
ChineseEnglish
  • ComponentsComponents
  • ThemeTheme

Global Navigation

  • Navbar
  • BeianFooter
  • Brand
  • AppLauncher
  • Sidebar
  • NavMenu
  • NavigationMenu
  • Menu
  • Menubar
  • Dock
  • BubbleMenu
  • CardNav
  • FlowingMenu
  • GooeyNav
  • PillNav
  • StaggeredMenu

In-page Navigation

  • RouteTabs
  • Tabs
  • Breadcrumb
  • Pagination
  • Anchor
  • Affix
  • BackTop
  • Stepper
  • Steps
  • PageHeader

Actions and Tools

  • Command
  • ContextMenu
  • Toolbar
  • Accordion
  • Collapsible
  • Link
  • AnimatedThemeToggler

NavigationMenu

navigation-menu

Provides triggers, links, and rich navigation panels through a shared animated viewport.

Usage

Basic usage

Trigger + Content combination hover to expand the shared floating layer; pure link items are directly placed in Link without Content.

  • Price
tsx
<NavigationMenu>
  <NavigationMenuList>
    <NavigationMenuItem value="resources">
      <NavigationMenuTrigger>Resources</NavigationMenuTrigger>
      <NavigationMenuContent>
        <ul className="w-56">
          <li><NavigationMenuLink href="#" className="block px-3 py-2">Document Center</NavigationMenuLink></li>
          <li><NavigationMenuLink href="#" className="block px-3 py-2">Component library</NavigationMenuLink></li>
        </ul>
      </NavigationMenuContent>
    </NavigationMenuItem>
    <NavigationMenuItem value="pricing">
      <NavigationMenuLink href="#">Price</NavigationMenuLink>
    </NavigationMenuItem>
  </NavigationMenuList>
</NavigationMenu>

Mega panel

Content has free layout, and you can place a multi-column card grid to make a large navigation panel, and the panel size automatically deforms with the content.

tsx
<NavigationMenu>
  <NavigationMenuList>
    <NavigationMenuItem value="products">
      <NavigationMenuTrigger>Product</NavigationMenuTrigger>
      <NavigationMenuContent>
        <div className="grid w-[28rem] grid-cols-2 gap-1">
          {products.map((p) => (
            <NavigationMenuLink key={p.title} href="#" className="block px-3 py-2">
              <div className="font-medium text-foreground">{p.title}</div>
              <div className="mt-0.5 text-xs text-muted-foreground">{p.desc}</div>
            </NavigationMenuLink>
          ))}
        </div>
      </NavigationMenuContent>
    </NavigationMenuItem>
  </NavigationMenuList>
</NavigationMenu>

Zero delay on

delay={0} opens on hover, without opening delay.

  • Price
tsx
<NavigationMenu delay={0}>{/* ...List */}</NavigationMenu>

When to use

Use NavigationMenu for primary site navigation that groups links under headings such as Products or Resources and opens rich mega panels with columns, icons, and descriptions. Use Navbar for a simple row of links, Menu for click-triggered commands such as Edit or Delete, or Menubar for a desktop-style File/Edit/View menu bar.

Import

ts
import { NavigationMenu, NavigationMenuList, NavigationMenuItem, NavigationMenuTrigger, NavigationMenuContent, NavigationMenuLink } from "@hulianui/ui"

Props

The root NavigationMenu forwards Base UI NavigationMenu.Root props. Each subcomponent forwards the corresponding Base UI part and adds className.

NameTypeDefaultDescription
valueany-Controlled value of the currently open item.
defaultValueany-Initially open item when uncontrolled.
delaynumber100Delay before opening on hover, in milliseconds. Use 0 to open immediately.
closeDelaynumber-Delay before closing after the pointer leaves, in milliseconds.
orientation"horizontal" | "vertical""horizontal"Menu-bar orientation.
classNamestring-Additional root class name.

Subcomponents accept className and forward their matching Base UI props. NavigationMenuItem requires value; NavigationMenuLink forwards anchor attributes such as href.

Events

EventTypeDescription
onValueChange(value) => voidCalled when the open item changes; forwarded to Base UI NavigationMenu.Root.

Example

tsx
<NavigationMenu>
  <NavigationMenuList>
    <NavigationMenuItem value="products">
      <NavigationMenuTrigger>Products</NavigationMenuTrigger>
      <NavigationMenuContent>
        <div className="grid grid-cols-2 gap-1">{/* NavigationMenuLink entries */}</div>
      </NavigationMenuContent>
    </NavigationMenuItem>
    <NavigationMenuItem value="pricing">
      <NavigationMenuLink href="/pricing">Pricing</NavigationMenuLink>
    </NavigationMenuItem>
  </NavigationMenuList>
</NavigationMenu>

Usage guidelines

  • [[base-ui-navigation-menu-content-must-stay-in-flow-for-popup-size-measure]]: do not add position: absolute to an active NavigationMenuContent. Base UI measures its natural size to animate the shared Viewport's --popup-width/height. Removing it from flow reduces the measured size to zero and can collapse an otherwise valid panel to roughly 2×2 pixels.
  • For a plain link without a dropdown, place NavigationMenuLink directly inside NavigationMenuItem; do not wrap it in Trigger and Content.

Related

Navbar · BeianFooter · NavMenu · Menu · Menubar · Dock

Playground

  • Price
<NavigationMenu>
  <NavigationMenuList>
    <NavigationMenuItem value="products">
      <NavigationMenuTrigger>Product</NavigationMenuTrigger>
      <NavigationMenuContent>
        <div className="grid grid-cols-2 gap-1">{/* NavigationMenuLink list */}</div>
      </NavigationMenuContent>
    </NavigationMenuItem>
    <NavigationMenuItem value="pricing">
      <NavigationMenuLink href="/pricing">Price</NavigationMenuLink>
    </NavigationMenuItem>
  </NavigationMenuList>
</NavigationMenu>
PreviousNavMenuNavigationNextMenu

On this page

  • Usage
  • Documentation
    • When to use
    • Import
    • Props
    • Events
    • Example
    • Usage guidelines
    • Related
  • Playground