Platform
VaultVault
  • Free15
  • Navigation19
  • Buttons9
  • Scroll55
  • Text27
  • Sliders & marquees19
  • Gallery & images67
  • Cursor24
  • Page transitions10
  • Loaders2
  • Backgrounds10
  • UI components33
ButtonsPart of ProButtons
IconsPart of ProIcons
  • Interface Essentials144
  • Social Icons69
  • Payment Badges41
SavedPart of ProSaved
Support
DocumentationDocumentation
MCP serverMCP server
SettingsSettings
VaultNavigationMega Menu
Logo Shuffle GridBrowse all 182Mesh Gradient Hero
  • Free15
  • Navigation19
  • Buttons9
  • Scroll55
  • Text27
  • Sliders & marquees19
  • Gallery & images67
  • Cursor24
  • Page transitions10
  • Loaders2
  • Backgrounds10
  • UI components33
  • Interface Essentials144
  • Social Icons69
  • Payment Badges41
Sign inSign in

Start free. The code for 15 components, no card needed.

Get 15 free

Mega Menu

This one is locked. Become a member to open the code for it and the rest of the Vault.

See plansTry the 15 free ones

What you'll need.

Install

  • gsap

Setup

npm i gsap

More like this

  • Menu
  • Mega menu
  • Header

Features.

  • Every section shares one dropdown panel: it drops in once, then morphs its height from section to section
  • The new section's columns slide in from the side you came from, then their links, then the preview card settles
  • An orange underline slides along under the triggers to the open section
  • Closing plays the reveal mirrored as the panel folds away, so it leaves the way it arrived, all inside 0.4s
  • Hover intent: 150ms before a section opens, 200ms grace to cross from a trigger into the panel
  • Links pop an orange dot and step aside on hover, with a mouse only; a link can swap the section's preview card (image and title) while hovered or focused
  • A blurred scrim dims the page under the panel; clicking it, clicking outside, Escape or tabbing away closes the panel (on phones the same outside tap or tab closes the drawer)
  • Full keyboard support: arrow keys between triggers and links, Home / End, Escape back to the trigger. Closing returns focus to the trigger, unless you tabbed away
  • On phones the triggers fold into a burger drawer (0.8s open, 0.6s close) and each section opens inside it on tap; the drawer scrolls under the logo row on short screens and the page stays scrollable behind it
  • Two opening modes: hover (with click as well) or click only
  • Respects prefers-reduced-motion: panels and the drawer swap with no animation, and hover opening is off
  • GSAP only, plain CSS for the look

How to get it right.

Keep sections a similar size

The panel morphs between section heights, which reads best when the difference is modest. A two-row section next to a twelve-row one makes the panel jump; split the long one or give it more columns.

Give previews only to links that need one

Only links with data-mgm-src swap the card; the rest leave the section's own card in place. Use previews where a picture helps choose (projects, products), not on every link.

Set the slide to the density

data-au-shift sets how far columns travel. The default 4em suits two or three columns; drop it to 2 for dense panels or 0 for a plain fade.

Use click mode for touch-heavy audiences

data-au-open="click" turns hover off everywhere. Touch screens, small screens and reduced motion are click only in either mode.

Variations.

  • Hover — the default: sections open on hover after 150ms, and on click
  • Click — data-au-open="click": sections open only on click or keyboard
  • Calm — data-au-shift="0": no slide, the columns and links just fade in
  • Big swing — data-au-shift="8": columns travel twice as far between sections
  • Your colours — override --mgm-bar, --mgm-panel, --mgm-fg, --mgm-text, --mgm-accent and --mgm-button on .mgm_menu

Where it fits.

  • Studio and agency sites — work by type and place, services, people and a journal, the setup this demo shows
  • Product sites — product lines with a feature card per section
  • Shops — categories as columns, a campaign image as the card
  • Docs and resources — grouped links with a "start here" card

Frequently asked.

As many triggers as fit the bar. Each trigger's aria-controls must point at a data-mgm-group inside the menu, and the order of the triggers sets which way the columns slide.

Yes. Leave out the data-mgm-preview block; the columns take the full width.

The menu is position: fixed at the top of the page. For a transparent bar, set --mgm-bar to transparent; keep the panel opaque so the links stay readable.

At 767px and below the triggers move into a burger drawer, the preview cards and scrim are hidden, and each section opens inside the drawer on tap. The drawer is capped at the screen height and scrolls. It doesn't lock the page, because it opens over the page rather than replacing it: an outside tap closes it.

Each [data-au-mega-menu] is its own instance, but it's a site header: use one per page. Group ids must be unique on the page.

The card is an image and a title by default. The data-mgm-preview-eyebrow paragraph has to stay, because the swap needs it, so it ships empty and hidden. To use it, remove hidden, add the text, and give swapping links a data-mgm-eyebrow. For a link under the title, add <a class="mgm_preview-cta" href="...">. For a text link and a button in the bar, add a .mgm_actions block after the </nav>, holding .mgm_action and .mgm_cta links. The styles are still in code.css. In React, set eyebrow, cta and href on a card; add the bar actions to react.tsx.

Related components.

NewPro

Ink Spread Menu

Click

Pro

Folding Burger Nav

Scroll

Pro

Full-Screen Wipe Menu

Click