Skip to content

shadcn.io is an independent project built on shadcn/ui

Full Mega Menu Navigation Menu for React

A wide Platform menu with feature, resource, and company columns, plus Watch Tutorial and Contact Sales.

The bar shows Platform. The panel is a wide grid of feature, resource, and company links, a Getting Started card with Watch Tutorial, and a help card with Contact Sales.

Use the full panel when the header is the main way around a large site. A Sidebar fits an app that should keep that map on screen. In React, Base UI moves between the triggers with Tab.

Preview

Preview width

Installation

Sign in to get your install command
Free with an account. It carries your token, so the CLI installs everything in one go.
Use email insteadNo credit card

Anatomy

Navigation Menu anatomy: list, trigger, indicator, content, link

Usage

<div className="w-full max-w-md rounded-md border bg-background p-px">
  <NavigationMenu>
    <NavigationMenuList>
      <NavigationMenuItem>
        <NavigationMenuTrigger>Platform</NavigationMenuTrigger>
        <NavigationMenuContent>
          <div className="grid w-[900px] max-w-full grid-cols-[2fr_1fr_1fr] gap-6 p-4">
            <div className="flex flex-col gap-4">
              {featureGroups.map((group) => (
                <div className="flex flex-col gap-1" key={group.title}>
                  <h4 className="mb-2 px-2 font-semibold text-muted-foreground text-sm">
                    {group.title}
                  </h4>
                  {group.items.map((feature) => (
                    <NavigationMenuLink
                      className="items-start gap-2"
                      key={feature.label}
                      render={<Link href={feature.href} />}
                    >
                      <feature.icon aria-hidden="true" className="size-5" />
                      <div className="flex flex-col gap-0.5">
                        <span className="font-medium">{feature.label}</span>
                        <span className="text-muted-foreground">
                          {feature.description}
                        </span>
                      </div>
                    </NavigationMenuLink>
                  ))}
                </div>
              ))}
            </div>
{/* The rest of the file is under Installation. */}

FAQ

How are the columns laid out?

A three-column grid, grid-cols-[2fr_1fr_1fr]: the feature groups take the widest column, the resource and company links the middle, and the two panels the last.

How are the groups built?

From lists at the top of the file: two feature groups with descriptions and two link groups, each with a title. Resource links have icons; company links don't.

What happens on narrow screens?

The panel is w-[900px] with max-w-full, so it never grows past the screen, but its columns get tight. Below the md breakpoint, show the same links in a Sheet or a Drawer instead.

How do the links use my router?

Each link is your router's link rendered through NavigationMenuLink, so it keeps the menu's styles and focus handling. NavigationMenuLink takes the Next.js Link through render, as in render={<Link href="#" />}.

How does the menu work from the keyboard?

Tab moves between the triggers and the links, Enter or Space opens a trigger's panel, and Escape closes it and returns focus to the trigger. The root is a nav, so screen readers list it as a navigation landmark.

How do I mark the current page?

Set aria-current="page" on the NavigationMenuLink that matches the route, and style it with the aria-[current=page]: variant. active on NavigationMenuLink sets it for you.

API Reference

Navigation Menu

No extra props in this demo. The rest is on the Navigation Menu page.

Button

Sets size="sm" and variant="outline". The rest is on the Button page.