Design systems, in the open.
One bar, three menus, everything one click away.
Live preview. Hover or tab to the top items; Escape closes the panel.
MegaNav
Marketing nav with hover and focus mega menus. Top-level items are buttons; the panel is a full-width, rounded, blurred sheet with a featured row and grouped columns of links. Opens on hover and focus, closes on Escape, on outside pointer down, and on route change. Below 1024px the nav collapses into a full-screen sheet.
Props
| Prop | Type | Default | Notes |
|---|---|---|---|
brand |
string |
required | Wordmark text. |
brandHref |
string |
"/" |
Brand target. |
logo |
string |
unset | Optional 24px logo image. |
menus |
MegaNavMenu[] |
required | Trigger label, optional featured row, and up to 4 link groups each. |
loginLabel |
string |
"Log in" |
Quiet pill on the right. |
loginHref |
string |
"/login" |
Target for the quiet pill. |
signupLabel |
string |
"Sign up" |
Filled pill on the right. |
signupHref |
string |
"/signup" |
Target for the filled pill. |
tone |
"dark" | "light" |
"dark" |
Light text for dark artwork, or dark text for light backgrounds. |
lockScroll |
boolean |
true |
Lock page scroll while the mobile sheet is open. Pass false inside embeds and previews. |
MegaNavMenu looks like this:
{
label: "Products",
featured: { label: "Discover Products", href: "/products" },
columns: [
{ heading: "Ship", links: [{ label: "XEHkit", href: "/xehkit" }] },
],
}
Usage
import { MegaNav } from "@xeh/xehkit/components/mega-nav/MegaNav";
import "@xeh/xehkit/xehkit.css";
<MegaNav
brand="XEH"
menus={menus}
signupHref="/xehkit"
tone="dark"
/>
Notes
- Client component. Uses
next/linkandnext/navigation. - Menus open on hover and on focus. Focus on a trigger opens its panel, so the full menu is reachable without a mouse: Tab moves from the last trigger into the open panel, then to the actions.
- Escape closes the panel and returns focus to the trigger that opened it. Pointer down outside the nav closes it. Route changes close it.
- The panel is a
regionwith anaria-label, not amenu, so its links keep normal tab order and no arrow-key contract is imposed. - The blurred panel needs a non-solid backdrop to show through, which is why the default tone is designed for dark artwork.