Installation
$ pnpm dlx shadcn@latest add @synccn/navigation-menuFirst time in this project? Connect synccn with one command.
Usage
import { NavigationMenu } from "@/components/ui/navigation-menu";<NavigationMenu items={items} />API reference
Generated from the component's TypeScript types, so it always matches the code.
NavigationMenu
Site navigation with dropdown panels (a mega menu on wide screens). items: [{ label, href? } | { label, links: [{ title, description, href, icon? }], featured? }]
PropTypeDescription
- itemsrequired
NavigationItem[]Top-level items.
- className
stringExtra classes for the root element.
Dependencies
Read from the component's imports when the site builds. The CLI installs all of these for you.
Helpers
npm packages
- clsx for cn()
- tailwind-merge for cn()
- lucide-react for ChevronDown
Keyboard
- TabMove between triggers and links
- EnterorSpaceOpen a panel
- EscClose the panel
Accessibility
- Panels open on hover and on click, so they work on touch screens too.
From the source
Read from this component's code when the site builds, so it can't drift.
- ARIA attributes: aria-expanded, aria-label
- Closes with Escape
- Closes when you click or tap outside
More navigation
BreadcrumbPath to the current page, with chevrons or slashes.PaginationPage numbers with ellipses for long ranges.StepperProgress through a multi-step flow.DockApp dock that magnifies icons near the pointer.SidebarCollapsible app sidebar with groups, badges and nested items.Scroll ProgressReading progress bar for the page or any scroll container.