Skip to content

Products Mega Menu

Tailwind CSS mega menu with two columns of product links, icons and descriptions, a featured promo card and full keyboard support.

Also known as: mega menu, navbar dropdown with featured card, large dropdown menu, product menu

Products Mega Menu live demo

Open in new tab

Tailwind CSS code (HTML, CSS, JS)

A products mega menu built with Tailwind CSS: a clean white navbar whose "Products" button opens a full-width panel with two columns of icon links, short descriptions, a dark featured card and a footer strip of secondary links. It suits SaaS marketing sites and product companies with more offerings than a simple dropdown can hold.

How it works

The root .tmm-root wraps a header with the nav and the panel #tmm-panel (data-tmm-panel), which sits directly below the bar with absolute inset-x-0 top-full and starts hidden. The panel grid is one column on phones, two from md and lg:grid-cols-[1fr_1fr_19rem] on desktops, where the featured card takes the third column. A max-h-[calc(100dvh-4rem)] overflow-y-auto limit keeps the panel scrollable on short screens. A .tmm-scrim layer (data-tmm-scrim) dims the page while the menu is open.

script.js initializes every .tmm-root on DOMContentLoaded. The data-tmm-trigger button toggles the panel and its aria-expanded state; the aria-expanded: variants tint the button and the group-aria-expanded:rotate-180 chevron flips. Arrow Down on the trigger opens the panel and focuses the first link; inside the panel Arrow Up, Arrow Down, Home and End move between links. Escape closes the panel and returns focus to the trigger, and the menu also closes when focus leaves the header or the user clicks anywhere outside it. style.css adds the tmm-drop and tmm-fade entrance animations.

Customization

  • Remove data-tmm-start-open from .tmm-root so the menu starts closed; it is only there so the demo shows the open panel.
  • bg-teal-100 text-teal-700 and group-hover:bg-teal-600 on the icon boxes: change the accent color of every product icon.
  • from-teal-800 to-emerald-950 on the featured card: restyle the promo block, or delete the card and use lg:grid-cols-2 on the panel grid.
  • lg:grid-cols-[1fr_1fr_19rem] on the panel grid: add a third link column with lg:grid-cols-[1fr_1fr_1fr_19rem].
  • bg-slate-900/20 on .tmm-scrim: make the page dimming stronger or remove the scrim element entirely.
  • animation: tmm-drop 0.22s in style.css: tune or remove the slide-down motion.
  • The "New" pill (bg-amber-100 text-amber-800): move it to any other product title.

Use cases

  • SaaS marketing sites: two columns of icon links and descriptions list many products at once
  • Product companies: a dark featured promo card promotes a new release inside the open menu
  • Large catalogs: a footer strip of secondary links adds extra destinations
  • Keyboard users: the full-width panel can be opened and navigated using the keyboard alone

Accessibility

The trigger is a real button with aria-controls="tmm-panel" and an aria-expanded state kept in sync by the script. Each column is a section labelled by its heading through aria-labelledby, links have descriptive text and decorative SVGs are aria-hidden. The menu is fully keyboard operable with Tab, the arrow keys, Home, End and Escape, and focus returns to the trigger after Escape. All controls show a teal focus outline, and the entrance animations are disabled under prefers-reduced-motion: reduce.

Usage notes

The panel opens on click rather than hover, which works the same on touch screens and avoids accidental openings. Use unique id values when placing several menus on one page.

Products Mega Menu at a glance

Framework
Tailwind CSS
Code
HTML, CSS, JavaScript
JavaScript
Vanilla JavaScript, no jQuery
Dependencies
Tailwind CSS
Layout
Responsive, works on mobile
Category
Mega Menus
License
Free for personal and commercial use

Questions about this template

Can I use the Products Mega Menu code for free?

Yes. You can copy or download the code and use it in personal and commercial projects, including client work. No sign-up is needed. Reselling it as part of a component library or template collection is not allowed; see the license.

How do I add it to my website?

Load Tailwind CSS from a CDN (the links are under Requirements). Paste the HTML where the component should appear, add the CSS to your stylesheet and load the JavaScript before the closing </body> tag. Download HTML gives you a complete page with everything already linked.

Does it need jQuery or a JavaScript framework?

No. The script is plain vanilla JavaScript, so it works without jQuery, React or Vue. You can still use the markup inside those frameworks.

Does it work on mobile?

Yes. The layout adapts to small screens. Use the Mobile and Tablet buttons above the live demo to check it at phone and tablet width.

Requirements

Add these to your page (already included in the download):

  • <script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"></script>

The Tailwind browser build is for prototyping. In production, compile Tailwind with its CLI or your bundler.

Products Mega Menu – free Tailwind CSS mega menu template
Products Mega Menu · free Tailwind CSS mega menu template

More Mega Menus

Bootstrap Mega Menu Dropdown – free Bootstrap 5 mega menu template

Bootstrap Mega Menu Dropdown

Full-width Bootstrap 5 mega menu with icon feature links, link columns and a gradient promo block, keyboard friendly and stacked on mobile.