Skip to content
synccn

Navigation Menu

Site navigation with mega-menu panels.

Installation

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

First 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? }]

  • itemsrequired
    NavigationItem[]

    Top-level items.

  • className
    string

    Extra 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

  • lib/utilscn (merges class names)
  • lib/hooksuseClickOutside (closes on an outside click), useEscape (closes on Escape)

npm packages

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