niceui

Mega Menu New

A desktop mega menu with one shared panel that morphs its size and position between menus, hover intent, an icon grid or described list per menu, a preview card that follows the hovered link, keyboard support and an accordion sheet on phones.

Often searched as mega menudropdown navigationnavbar menu

ReactTailwind CSSTypeScriptMarketingMIT · Free
Live preview
One file. Nothing to install.Pure React + Tailwind CSS · icons and animations inlined · 795 lines
Download .tsx

Installation

01

Install with the shadcn CLI. The NiceUI theme comes along the first time.

$ npx shadcn@latest add https://niceui.dev/r/marketing-mega-menu.json
02

Or copy the source below (6 files). Dependencies: lucide-react.

Source

components/niceui/marketing/MegaMenuDemo.tsx
import { MegaMenu } from '@/components/niceui/marketing/MegaMenu';
import { QUARRY_MENU } from '@/components/niceui/pages/landing/quarry/Nav';
import { Wordmark } from '@/components/niceui/pages/landing/quarry/ui';

/** The mega menu on its own: hover Library, Parts, Templates or Tools. */
export function MegaMenuDemo() {
  return (
    <div className="h-[560px] w-full bg-[#0e0e0d] font-sans">
      <div className="border-b border-white/[.05] px-5 md:px-8">
        <MegaMenu
          items={QUARRY_MENU}
          defaultOpen={0}
          brand={<Wordmark />}
          actions={
            <a href="#" className="rounded-lg bg-[#f2efe9] px-3.5 py-2 text-[13.5px] font-medium text-[#141413] hover:bg-white">
              Get started
            </a>
          }
        />
      </div>
      <div className="px-8 pt-16 md:hidden">
        <p className="text-[13px] text-white/50">Open the menu button for the mobile sheet.</p>
      </div>
    </div>
  );
}

FAQ

How do I add this mega menu to a React app?

Install Mega Menu with the shadcn CLI (npx shadcn@latest add https://niceui.dev/r/marketing-mega-menu.json) or copy the source from this page. It is plain React and Tailwind CSS, so it works in Next.js, Vite, Remix and Astro.

Is this mega menu free to use?

Yes. Mega Menu is free and MIT licensed, so you can use it in personal, commercial and client projects.

Can I customise the mega menu?

Yes. The full source lives in your project after you install it, so you can change colours, timing and markup. It uses Tailwind classes and works in light and dark themes.