GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Docs
  • Components
  • Blocks
  • TemplatesNew
  • Sponsors
  • Icons
  • New
  • Installation
  • Theming
  • RTL
  • Fonts
  • Persian Conventions
  • FAQ
  • AI

This view

  • Original page
  • New address

GeezerVison is showing ui.persian-labs.ir — Navigation Menu

Navigation Menu

A collection of links for navigating websites, with dropdown panels that share a single animated viewport.

Last updated January 1, 1980

CreditsModifiedPublished

Copied from shadcn/ui.

  • Replaced the multi-icon-library IconPlaceholder abstraction with a plain lucide-react ChevronDownIcon
  • Converted the trigger chevron's ml-1 spacing to logical ms-1 so the gap sits between label and icon in both directions
  • Added rtl: variants mirroring the panel's enter/exit slide translations and the indicator arrow, so animation direction follows the writing direction

Overview

Installation

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

Usage

import {
 
  NavigationMenu,
  NavigationMenuContent,
  NavigationMenuItem,
  NavigationMenuLink,
  NavigationMenuList,
  NavigationMenuTrigger,
} from "@/components/ui/navigation-menu"
 
<NavigationMenu>
  <NavigationMenuList>
    <NavigationMenuItem>
      <NavigationMenuTrigger>Item One</NavigationMenuTrigger>
      <NavigationMenuContent>
        <NavigationMenuLink>Link</NavigationMenuLink>
      </NavigationMenuContent>
    </NavigationMenuItem>
  </NavigationMenuList>
</NavigationMenu>

Link Component

Use the render prop to compose a custom link component such as Next.js Link while keeping the menu behavior.

import Link from "next/link"
 
<NavigationMenuItem>
  <NavigationMenuLink
    render={<Link href="/docs" />}
    className={navigationMenuTriggerStyle()}
  >
    Documentation
  </NavigationMenuLink>
</NavigationMenuItem>

RTL

Wrap your application — or just the menu — in Base UI's DirectionProvider with direction="rtl" and the menu follows the reading direction automatically: panel alignment mirrors (the default align opens panels along the reading flow; pass one explicitly to override), and enter/exit slides mirror through Tailwind rtl: variants. Content panels render in a portal at document.body, so on a site that isn't RTL by default also pass dir="rtl" to the menu root and each NavigationMenuContent for correct text layout inside the panel.

API Reference

NavigationMenu

PropTypeDefaultDescription
align"start" | "center" | "end"mirrors with directionHow the content popup aligns to the trigger. Defaults to start in LTR and end in RTL, read from Base UI's DirectionProvider context; pass an explicit value to override.
classstring-Additional classes for the root element.
…propsNavigationMenuPrimitive.Root.Props-All other props are forwarded to the Base UI Navigation Menu root. See the Base UI docs for the full list.

NavigationMenuTrigger

PropTypeDefaultDescription
classstring-Additional classes merged over navigationMenuTriggerStyle().

NavigationMenuContent

PropTypeDefaultDescription
classstring-Additional classes for the content panel rendered inside the shared viewport.

NavigationMenuLink

PropTypeDefaultDescription
renderReactElement | function-Render as a custom element such as next/link while keeping menu behavior.
classstring-Additional classes for the link.

See the Base UI Navigation Menu docs for the full prop and part reference.

Edit this page on GitHub
PreviousNative SelectNextPagination

Sponsors

Become a sponsor
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.