Mega Menu 1
Mega menu that keeps every offer one tap away. A dark recommended-offer letter carries its own action beside a light half of offer cards and benefit-led links. On phones it becomes an accordion drawer with the action pinned at the foot.
Use it in a prompt
Use nav/mega-menu from the FunnelDNA library. Follow the skill and theme contract. Ask me for the copy, images, and brand details you need; do not invent proof.
Paste into Claude or ChatGPT with FunnelDNA connected (MCP setup), or alongside the skill.
Use it in code
- Save
component.tsx(Code tab) ascomponents/funneldna/nav/mega-menu.tsx. - Import it and pass your copy and images (Props tab):
import { MegaMenu } from "@/components/funneldna/nav/mega-menu"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/nav/mega-menu/component.tsx 752 lines
// layout: split-contrast
// Mega menu that keeps every offer one tap away. A dark recommended-offer letter carries its own action beside a light half of offer cards and benefit-led links. On phones it becomes an accordion drawer with the action pinned at the foot.
import * as React from 'react'
import { ChevronDown, Lock, Menu, Route, ShieldCheck, X } from 'lucide-react'
export type MegaMenuOffer = {
name: string
/** One-line promise under the name */
promise: string
/** Price text, e.g. '$47' or 'Free' */
price: string
/** Shows the price in the success colour */
free?: boolean
/** Navigation destination of the offer card */
href?: string
/** Image slot item-n */
image?: string
imageAlt?: string
/** Short flag beside the price, e.g. 'Start here' */
flag?: string
}
export type MegaMenuFeatured = {
salutation?: string
/** Short letter paragraphs. Phones show the first one */
body: React.ReactNode[]
signoff?: string
/** Name under the sign-off */
signer?: string
price: string
/** Marks a free offer: the reassurance line shows a lock instead of a shield */
free?: boolean
/** Line beside the price, e.g. 'One payment · Lifetime access'. Each ' · ' segment sits on its own line */
priceNote?: string
/** The alternative the price stands against, e.g. 'vs. hiring a copywriter' */
anchor?: string
/** Button label */
label: string
/** One line under the button */
reassurance?: string
/** Button destination */
href?: string
}
export type MegaMenuLink = { label: string; href: string }
export type MegaMenuGroup = { title: string; links: MegaMenuLink[] }
export type MegaMenuPanel = {
heading: string
/** Text link beside the heading; shown only with allHref */
allLabel?: string
allHref?: string
offers: MegaMenuOffer[]
/** Dark letter with its own action; without it the offers fill the panel */
featured?: MegaMenuFeatured
/** Benefit-led link columns under the offers */
groups?: MegaMenuGroup[]
}
/** A top-level item: a panel opens a mega panel, otherwise it is a plain link to href */
export type MegaMenuItem = { id: string; label: string; href?: string; panel?: MegaMenuPanel }
export type MegaMenuCta = {
label: string
/** Bar label on tablets and phones */
shortLabel?: string
href?: string
/** Line under the action at the foot of the phone drawer */
note?: string
}
/** Passed to onAction: id is 'brand', 'cta', an item id, or '<item id>:<offer|featured|link|all>' */
export type MegaMenuAction = { id: string; label: string; href?: string }
export type MegaMenuCopy = {
/** Accessible name of the nav landmark */
navLabel: string
/** Accessible label of the phone menu toggle while closed */
openMenu: string
/** Accessible label of the phone menu toggle while open */
closeMenu: string
/** Separator screen readers hear between price-note segments */
noteSeparator: string
}
export type MegaMenuProps = {
/** Wordmark text, also the logo's fallback alt */
brand?: string
brandHref?: string
/** Image slot logo. Replaces the wordmark */
logoImage?: string
logoAlt?: string
items?: MegaMenuItem[]
/** The always-visible action in the bar and at the foot of the phone drawer */
cta?: MegaMenuCta
/** Sticks the bar to the top of the page */
sticky?: boolean
/** Item id whose panel starts open (desktop panel and phone accordion) */
defaultOpen?: string
/** Phone drawer starts open */
defaultMenuOpen?: boolean
/** Milliseconds before a hovered item opens */
hoverDelay?: number
/** Milliseconds before the panel closes after the pointer leaves */
closeDelay?: number
/** Called on every link, offer and button activation */
onAction?: (action: MegaMenuAction) => void
/** Accessible labels and separators */
copy?: Partial<MegaMenuCopy>
className?: string
}
export function MegaMenu(props: MegaMenuProps) {
const {
brand = 'Funnel Starter',
brandHref = '#',
logoImage,
logoAlt,
items = DEFAULT_ITEMS,
cta = DEFAULT_CTA,
sticky = false,
defaultOpen,
defaultMenuOpen = false,
hoverDelay = 140,
closeDelay = 280,
onAction,
copy,
className,
} = props
const c: MegaMenuCopy = { ...DEFAULT_COPY, ...copy }
const [openId, setOpenId] = React.useState<string | null>(defaultOpen ?? null)
const [drawer, setDrawer] = React.useState(defaultMenuOpen)
const [accId, setAccId] = React.useState<string | null>(defaultOpen ?? null)
const rootRef = React.useRef<HTMLElement>(null)
const toggleRef = React.useRef<HTMLButtonElement>(null)
const triggers = React.useRef<Record<string, HTMLButtonElement | null>>({})
const openTimer = React.useRef<number | undefined>(undefined)
const closeTimer = React.useRef<number | undefined>(undefined)
const hoveredAt = React.useRef(0)
const focusFirst = React.useRef<string | null>(null)
const uid = 'cfmm' + React.useId().replace(/[^a-zA-Z0-9]/g, '')
const idFor = (kind: string, id: string) => `${uid}-${kind}-${id.replace(/[^a-zA-Z0-9_-]/g, '-')}`
const clearTimers = React.useCallback(() => {
window.clearTimeout(openTimer.current)
window.clearTimeout(closeTimer.current)
}, [])
React.useEffect(() => clearTimers, [clearTimers])
const focusPanel = (id: string) => {
const sel = `[id='${idFor('panel', id)}']`
rootRef.current?.querySelector<HTMLElement>(`${sel} a, ${sel} button`)?.focus()
}
React.useEffect(() => {
if (!openId || focusFirst.current !== openId) return
focusFirst.current = null
focusPanel(openId)
})
React.useEffect(() => {
if (!openId && !drawer) return
const root = rootRef.current
const doc = root?.ownerDocument ?? document
const onDown = (e: PointerEvent) => {
if (root && !root.contains(e.target as Node)) {
setOpenId(null)
setDrawer(false)
}
}
doc.addEventListener('pointerdown', onDown)
return () => doc.removeEventListener('pointerdown', onDown)
}, [openId, drawer])
const pick = (id: string, label: string, href?: string) => {
clearTimers()
onAction?.({ id, label, href })
setOpenId(null)
setDrawer(false)
}
const hoverOpen = (id: string) => (e: React.PointerEvent) => {
if (e.pointerType !== 'mouse') return
clearTimers()
if (openId === id) return
if (openId) {
setOpenId(id)
hoveredAt.current = Date.now()
return
}
openTimer.current = window.setTimeout(() => {
setOpenId(id)
hoveredAt.current = Date.now()
}, hoverDelay)
}
const hoverPlain = (e: React.PointerEvent) => {
if (e.pointerType !== 'mouse' || !openId) return
clearTimers()
closeTimer.current = window.setTimeout(() => setOpenId(null), closeDelay)
}
const clickTrigger = (id: string) => {
clearTimers()
if (openId === id) {
if (Date.now() - hoveredAt.current < 500) {
hoveredAt.current = 0
return
}
setOpenId(null)
} else {
setOpenId(id)
}
hoveredAt.current = 0
}
const openAndFocus = (id: string) => {
clearTimers()
if (openId === id) {
focusPanel(id)
return
}
focusFirst.current = id
setOpenId(id)
}
const onKeyDown = (e: React.KeyboardEvent) => {
if (e.key !== 'Escape') return
if (openId) {
const id = openId
clearTimers()
setOpenId(null)
triggers.current[id]?.focus()
e.stopPropagation()
} else if (drawer) {
setDrawer(false)
toggleRef.current?.focus()
e.stopPropagation()
}
}
const onBlur = (e: React.FocusEvent) => {
const next = e.relatedTarget as Node | null
if (next && !rootRef.current?.contains(next)) {
clearTimers()
setOpenId(null)
}
}
const rootClass = ['cf-mega', sticky && 'cf-mega--sticky', drawer && 'cf-mega--drawer', className].filter(Boolean).join(' ')
return (
<header
ref={rootRef}
className={rootClass}
onKeyDown={onKeyDown}
onBlur={onBlur}
onPointerEnter={(e) => {
if (e.pointerType === 'mouse') window.clearTimeout(closeTimer.current)
}}
onPointerLeave={(e) => {
if (e.pointerType !== 'mouse') return
clearTimers()
if (openId) closeTimer.current = window.setTimeout(() => setOpenId(null), closeDelay)
}}
>
<style>{CSS}</style>
<nav aria-label={c.navLabel}>
<div className='cf-mega__inner'>
<div className='cf-mega__wrap cf-mega__bar'>
<a className='cf-mega__brand' href={brandHref} onClick={() => onAction?.({ id: 'brand', label: brand, href: brandHref })}>
{logoImage ? (
<img src={logoImage} alt={logoAlt ?? brand} />
) : (
<>
<Route size={24} strokeWidth={2.5} aria-hidden className='cf-mega__brand-ico' />
<span>{brand}</span>
</>
)}
</a>
<ul className='cf-mega__links'>
{items.map((item) => (
<li key={item.id}>
{item.panel ? (
<button
ref={(el) => {
triggers.current[item.id] = el
}}
id={idFor('trigger', item.id)}
type='button'
className='cf-mega__item'
aria-expanded={openId === item.id}
aria-controls={idFor('panel', item.id)}
onClick={() => clickTrigger(item.id)}
onKeyDown={(e) => {
if (e.key === 'ArrowDown') {
e.preventDefault()
openAndFocus(item.id)
}
}}
onPointerEnter={hoverOpen(item.id)}
onPointerLeave={() => window.clearTimeout(openTimer.current)}
>
{item.label}
<ChevronDown size={16} strokeWidth={2.5} aria-hidden className='cf-mega__chev' />
</button>
) : (
<a className='cf-mega__item' href={item.href ?? '#'} onPointerEnter={hoverPlain} onClick={() => pick(item.id, item.label, item.href)}>
{item.label}
</a>
)}
</li>
))}
</ul>
<div className='cf-mega__end'>
{cta ? (
<Action href={cta.href} onClick={() => pick('cta', cta.label, cta.href)}>
<span className='cf-mega__long'>{cta.label}</span>
<span className='cf-mega__short'>{cta.shortLabel ?? cta.label}</span>
</Action>
) : null}
<button
ref={toggleRef}
type='button'
className='cf-mega__toggle'
aria-expanded={drawer}
aria-controls={idFor('drawer', 'menu')}
aria-label={drawer ? c.closeMenu : c.openMenu}
onClick={() => setDrawer((v) => !v)}
>
{drawer ? <X size={24} strokeWidth={2.5} aria-hidden /> : <Menu size={24} strokeWidth={2.5} aria-hidden />}
</button>
</div>
</div>
</div>
{items.map((item) => {
const p = item.panel
if (!p) return null
const onPick = (kind: string, label: string, href?: string) => pick(`${item.id}:${kind}`, label, href)
return (
<div
key={item.id}
id={idFor('panel', item.id)}
role='region'
aria-labelledby={idFor('trigger', item.id)}
className='cf-mega__panel'
hidden={openId !== item.id}
>
<div className='cf-mega__inner'>
<div className={'cf-mega__wrap cf-mega__split' + (p.featured ? '' : ' cf-mega__split--solo')}>
{p.featured ? <Featured f={p.featured} separator={c.noteSeparator} onPick={(l, h) => onPick('featured', l, h)} /> : null}
<div className='cf-mega__browse'>
<Offers panel={p} level='h2' stagger onPick={onPick} />
<Groups groups={p.groups} onPick={(l, h) => onPick('link', l, h)} />
</div>
</div>
</div>
</div>
)
})}
<div id={idFor('drawer', 'menu')} className='cf-mega__drawer' hidden={!drawer}>
<div className='cf-mega__inner'>
<div className='cf-mega__wrap'>
<ul className='cf-mega__acc'>
{items.map((item) => {
const open = accId === item.id
const p = item.panel
const onPick = (kind: string, label: string, href?: string) => pick(`${item.id}:${kind}`, label, href)
return (
<li key={item.id} className='cf-mega__acc-item'>
{p ? (
<>
<button
id={idFor('acc', item.id)}
type='button'
className='cf-mega__acc-btn'
aria-expanded={open}
aria-controls={idFor('accpanel', item.id)}
onClick={() => setAccId(open ? null : item.id)}
>
<span>{item.label}</span>
<ChevronDown size={20} strokeWidth={2.5} aria-hidden className='cf-mega__chev' />
</button>
<div
id={idFor('accpanel', item.id)}
role='region'
aria-labelledby={idFor('acc', item.id)}
className='cf-mega__acc-body'
hidden={!open}
>
<Offers panel={p} level='h3' onPick={onPick} />
{p.featured ? <Featured compact f={p.featured} separator={c.noteSeparator} onPick={(l, h) => onPick('featured', l, h)} /> : null}
<Groups groups={p.groups} onPick={(l, h) => onPick('link', l, h)} />
</div>
</>
) : (
<a className='cf-mega__acc-btn' href={item.href ?? '#'} onClick={() => pick(item.id, item.label, item.href)}>
{item.label}
</a>
)}
</li>
)
})}
</ul>
{cta ? (
<div className='cf-mega__drawer-cta'>
<Action block href={cta.href} onClick={() => pick('cta', cta.label, cta.href)}>
{cta.label}
</Action>
{cta.note ? <p className='cf-mega__note'>{cta.note}</p> : null}
</div>
) : null}
</div>
</div>
</div>
</nav>
</header>
)
}
export default MegaMenu
/** The primary action. Class names stay literal per variant so the button reads the --button-* role tokens in CSS */
function Action({ href, block, onClick, children }: { href?: string; block?: boolean; onClick: () => void; children: React.ReactNode }) {
if (href) {
return block ? (
<a className='cf-mega__btn cf-mega__btn--block' href={href} onClick={onClick}>
{children}
</a>
) : (
<a className='cf-mega__btn cf-mega__btn--bar' href={href} onClick={onClick}>
{children}
</a>
)
}
return block ? (
<button type='button' className='cf-mega__btn cf-mega__btn--block' onClick={onClick}>
{children}
</button>
) : (
<button type='button' className='cf-mega__btn cf-mega__btn--bar' onClick={onClick}>
{children}
</button>
)
}
/** The dark recommended-offer letter. Compact (phone drawer) keeps the first paragraph and drops the sign-off */
function Featured({ f, compact, separator, onPick }: { f: MegaMenuFeatured; compact?: boolean; separator: string; onPick: (label: string, href?: string) => void }) {
const body = compact ? f.body.slice(0, 1) : f.body
const Icon = f.free ? Lock : ShieldCheck
return (
<div className={'cf-mega__letter' + (compact ? ' cf-mega__letter--compact' : '')}>
{f.salutation ? <p className='cf-mega__salute'>{f.salutation}</p> : null}
{body.map((para, i) => (
<p className='cf-mega__para' key={i}>
{para}
</p>
))}
{!compact && (f.signoff || f.signer) ? (
<p className='cf-mega__sign'>
{f.signoff ? <span>{f.signoff}</span> : null}
{f.signer ? <strong>{f.signer}</strong> : null}
</p>
) : null}
<div className='cf-mega__price'>
<span className='cf-mega__fig'>{f.price}</span>
{f.priceNote ? (
<span className='cf-mega__terms'>
{splitNote(f.priceNote).map((seg, i) => (
<span key={i}>
{i > 0 ? <span className='cf-mega__sr'>{separator}</span> : null}
{seg}
</span>
))}
</span>
) : null}
{f.anchor ? <span className='cf-mega__anchor'>{f.anchor}</span> : null}
</div>
<Action block href={f.href} onClick={() => onPick(f.label, f.href)}>
{f.label}
</Action>
{f.reassurance ? (
<p className='cf-mega__assure'>
<Icon size={16} strokeWidth={2.5} aria-hidden className='cf-mega__ico' />
{f.reassurance}
</p>
) : null}
</div>
)
}
/** Panel heading, optional all-link and the offer cards (up to three columns) */
function Offers({ panel, level, stagger, onPick }: { panel: MegaMenuPanel; level: 'h2' | 'h3'; stagger?: boolean; onPick: (kind: string, label: string, href?: string) => void }) {
const H = level
const cols = Math.min(Math.max(panel.offers.length, 1), 3)
return (
<div className='cf-mega__offers-wrap'>
<div className='cf-mega__head'>
<H className='cf-mega__heading'>{panel.heading}</H>
{panel.allLabel && panel.allHref ? (
<a className='cf-mega__all' href={panel.allHref} onClick={() => onPick('all', panel.allLabel as string, panel.allHref)}>
{panel.allLabel}
</a>
) : null}
</div>
{panel.offers.length ? (
<ul className='cf-mega__offers' style={{ ['--cols' as string]: cols } as React.CSSProperties}>
{panel.offers.map((o, i) => (
<li key={o.name} className='cf-mega__offer-li' style={stagger ? { animationDelay: `${Math.min(0.07 * (i + 1), 0.28)}s` } : undefined}>
<a className='cf-mega__offer' href={o.href ?? '#'} onClick={() => onPick('offer', o.name, o.href)}>
{o.image ? (
<span className='cf-mega__thumb'>
<img src={o.image} alt={o.imageAlt ?? ''} loading='lazy' decoding='async' />
</span>
) : null}
<span className='cf-mega__offer-text'>
<span className='cf-mega__offer-name'>{o.name}</span>
<span className='cf-mega__offer-promise'>{o.promise}</span>
<span className='cf-mega__meta'>
<span className={'cf-mega__offer-price' + (o.free ? ' is-free' : '')}>{o.price}</span>
{o.flag ? <span className='cf-mega__flag'>{o.flag}</span> : null}
</span>
</span>
</a>
</li>
))}
</ul>
) : null}
</div>
)
}
/** Benefit-led link columns in a quiet grey well */
function Groups({ groups, onPick }: { groups?: MegaMenuGroup[]; onPick: (label: string, href?: string) => void }) {
if (!groups || !groups.length) return null
return (
<div className='cf-mega__groups'>
{groups.map((g) => (
<div key={g.title} className='cf-mega__group'>
<p className='cf-mega__group-title'>{g.title}</p>
<ul>
{g.links.map((l) => (
<li key={l.label}>
<a href={l.href} onClick={() => onPick(l.label, l.href)}>
{l.label}
</a>
</li>
))}
</ul>
</div>
))}
</div>
)
}
/** Splits 'One payment · Lifetime access' into lines so no separator dot is stranded at a line end */
function splitNote(note: string) {
const parts = note.split(/\s*·\s*/).filter(Boolean)
return parts.length ? parts : [note]
}
const DEFAULT_COPY: MegaMenuCopy = { navLabel: 'Main', openMenu: 'Open menu', closeMenu: 'Close menu', noteSeparator: ' · ' }
const DEFAULT_CTA: MegaMenuCta = { label: 'Save My Free Seat', shortLabel: 'Save My Seat', href: '#register', note: 'Free workshop · Watch online' }
const DEFAULT_ITEMS: MegaMenuItem[] = [
{
id: 'programs',
label: 'Programs',
panel: {
heading: 'Start with the piece you need tonight',
allLabel: 'Compare all programs',
allHref: '#programs',
featured: {
salutation: 'Dear friend,',
body: [
'If your funnel is still a blank page, start here.',
'The Funnel Starter Kit gives you the guide, the workbook and the checklist in one download. Plan it tonight, then build it page by page.',
],
signoff: 'To your first launch,',
signer: 'The Funnel Starter team',
price: '$47',
priceNote: 'One payment · Lifetime access',
anchor: 'vs. hiring a copywriter to write your pages',
label: 'Try It Risk-Free · $47',
reassurance: '30-day money-back guarantee',
href: '#checkout',
},
offers: [
{ name: 'The Funnel Starter Kit', promise: 'Plan, write and check your funnel before you launch.', price: '$47', flag: 'Start here', href: '#kit' },
{ name: 'Page Copy Workbook', promise: 'Draft your headline, offer, and call to action.', price: '$29', href: '#workbook' },
{ name: 'Launch Checklist', promise: 'Review the links, forms, and next steps before launch.', price: '$19', href: '#checklist' },
],
groups: [
{ title: 'Plan it tonight', links: [{ label: 'Funnel Planning Guide', href: '#guide' }, { label: 'Map the pages you need', href: '#pages' }, { label: 'Pick your one offer', href: '#offer' }] },
{ title: 'Write pages that sell', links: [{ label: 'Page Copy Workbook', href: '#workbook' }, { label: 'Headline starters', href: '#headlines' }, { label: 'Call-to-action lines', href: '#cta-lines' }] },
{ title: 'Launch with confidence', links: [{ label: 'Launch Checklist', href: '#checklist' }, { label: 'Test every link and form', href: '#testing' }, { label: 'Our 30-day guarantee', href: '#guarantee' }] },
],
},
},
{
id: 'free-training',
label: 'Free Training',
panel: {
heading: 'Learn the plan before you build',
allLabel: 'See all free training',
allHref: '#free-training',
featured: {
salutation: 'Dear friend,',
body: [
'Before you build a single page, watch the free Funnel Starter Workshop.',
'Walk through your offer, your page copy and your next steps, so you start with a plan.',
],
signoff: 'See you inside,',
signer: 'The Funnel Starter team',
price: 'Free',
free: true,
priceNote: 'On-demand workshop',
anchor: 'vs. guessing your way through launch',
label: 'Yes! Save My Seat',
reassurance: 'We respect your inbox. Unsubscribe anytime.',
href: '#register',
},
offers: [
{ name: 'Funnel Starter Workshop', promise: 'Map your offer, page copy and next steps.', price: 'Free', free: true, flag: 'Watch first', href: '#workshop' },
{ name: 'Offer Clarity Lesson', promise: 'Say what you sell in one clear sentence.', price: 'Free', free: true, href: '#lesson' },
],
groups: [
{ title: 'Watch and learn', links: [{ label: 'Funnel Starter Workshop', href: '#workshop' }, { label: 'Offer Clarity Lesson', href: '#lesson' }] },
{ title: 'Ready for the full plan?', links: [{ label: 'See the Funnel Starter Kit', href: '#kit' }, { label: 'Compare what’s inside', href: '#programs' }] },
],
},
},
{ id: 'results', label: 'Results', href: '#results' },
{ id: 'resources', label: 'Resources', href: '#resources' },
{ id: 'about', label: 'About', href: '#about' },
]
const CSS = `
.cf-mega{--mm-ink:var(--ink,#172033);--mm-muted:var(--muted,#4b5563);--mm-surface:var(--surface,#fff);--mm-card:var(--card,#fff);--mm-band:var(--band,#13294b);--mm-band-ink:var(--band-ink,#fff);--mm-line:oklch(from var(--mm-ink) l c h / .12);--mm-shadow:var(--shadow,oklch(.22 .03 260));--mm-focus:oklch(from var(--field-focus,var(--accent,#2563eb)) l c h / .45);--mm-gutter:clamp(16px,5vw,48px);--mm-ease:cubic-bezier(.2,.7,.2,1);position:relative;z-index:40;background:var(--mm-surface);color:var(--mm-ink);font-family:var(--font-body,system-ui,sans-serif);border-bottom:1px solid var(--mm-line)}
.cf-mega *,.cf-mega *::before,.cf-mega *::after{box-sizing:border-box}
.cf-mega--sticky{position:sticky;top:0;z-index:60;box-shadow:var(--shadow-sm,0 1px 2px oklch(.22 .03 260 / .18))}
:where(.cf-mega) ul{list-style:none;margin:0;padding:0}
:where(.cf-mega) p{margin:0}
.cf-mega__sr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}
.cf-mega :focus-visible{outline:3px solid var(--mm-focus);outline-offset:2px}
.cf-mega__inner{padding-inline:var(--mm-gutter)}
.cf-mega__wrap{width:100%;max-width:1120px;margin-inline:auto}
.cf-mega__bar{display:flex;align-items:center;gap:24px;min-height:76px}
.cf-mega__brand{display:inline-flex;align-items:center;gap:8px;flex:none;border-radius:8px;color:var(--mm-ink);text-decoration:none;font-family:var(--font-display,inherit);font-weight:var(--display-weight,800);font-size:1.25rem;line-height:1;letter-spacing:var(--display-tracking,-0.025em);white-space:nowrap}
.cf-mega__brand img{display:block;width:auto;height:36px;max-width:180px;object-fit:contain}
.cf-mega__brand-ico{flex:none;color:var(--accent,#2563eb)}
.cf-mega__links{display:flex;flex:1;align-items:center;justify-content:center;gap:4px;min-width:0}
.cf-mega__item{display:inline-flex;align-items:center;gap:6px;min-height:44px;padding:0 14px;border:0;border-radius:var(--button-radius,var(--radius,12px));background:transparent;color:var(--mm-ink);font:inherit;font-size:1rem;font-weight:700;line-height:1.2;text-decoration:none;white-space:nowrap;cursor:pointer;transition:background .16s ease,color .16s ease}
.cf-mega__item:hover{background:color-mix(in oklch,var(--mm-ink) 5%,var(--mm-surface))}
.cf-mega__item[aria-expanded=true]{background:color-mix(in oklch,var(--mm-ink) 8%,var(--mm-surface))}
.cf-mega__chev{flex:none;color:var(--mm-muted);transition:transform .2s var(--mm-ease)}
.cf-mega__item[aria-expanded=true] .cf-mega__chev,.cf-mega__acc-btn[aria-expanded=true] .cf-mega__chev{transform:rotate(180deg)}
.cf-mega__end{display:flex;align-items:center;gap:12px;flex:none}
.cf-mega__short{display:none}
.cf-mega__btn{--b:var(--button-bg,var(--cta,#d63a2a));--b2:var(--button-bg-2,var(--cta-2,#b52e20));display:inline-flex;align-items:center;justify-content:center;min-height:56px;padding:0 28px;border:0;border-radius:var(--button-radius,var(--radius,12px));background:linear-gradient(oklch(from var(--b) calc(l + .04) c h),oklch(from var(--b2) calc(l - .02) c h));color:var(--button-ink,var(--cta-ink,#fff));font-family:var(--button-font,var(--font-display,inherit));font-weight:var(--button-weight,800);text-transform:var(--button-case,none);font-size:clamp(1.0625rem,1.3vw,1.125rem);line-height:1.15;letter-spacing:-0.005em;text-align:center;text-decoration:none;text-shadow:var(--button-text-shadow,none);white-space:nowrap;cursor:pointer;-webkit-tap-highlight-color:transparent;box-shadow:var(--button-shadow,inset 0 1px 0 oklch(from var(--b) calc(l + .14) c h / .7),inset 0 -3px 0 oklch(from var(--b) calc(l - .16) c h),0 1px 2px oklch(from var(--mm-shadow) l c h / .3),0 8px 16px -6px oklch(from var(--mm-shadow) l c h / .45));transition:transform .16s ease,box-shadow .16s ease,background .16s ease}
.cf-mega__btn:hover{transform:translateY(-1px);background:linear-gradient(oklch(from var(--b) calc(l - .01) c h),oklch(from var(--b2) calc(l - .07) c h));box-shadow:var(--button-shadow,inset 0 1px 0 oklch(from var(--b) calc(l + .12) c h / .7),inset 0 -3px 0 oklch(from var(--b) calc(l - .18) c h),0 1px 2px oklch(from var(--mm-shadow) l c h / .32),0 10px 18px -6px oklch(from var(--mm-shadow) l c h / .55))}
.cf-mega__btn:active{transform:translateY(1px);box-shadow:inset 0 2px 4px oklch(from var(--b) calc(l - .22) c h / .55),inset 0 -2px 0 oklch(from var(--b) calc(l - .16) c h),0 1px 2px oklch(from var(--mm-shadow) l c h / .3)}
.cf-mega__btn--bar{min-height:48px;padding:0 22px;font-size:1rem}
.cf-mega__btn--block{width:100%;min-height:60px;padding:12px 24px;white-space:normal;text-wrap:balance}
.cf-mega__toggle{display:none;align-items:center;justify-content:center;flex:none;width:44px;height:44px;padding:0;border:1px solid var(--button-2-border,transparent);border-radius:var(--button-radius,var(--radius,12px));background:var(--button-2-bg,var(--secondary,#eef1f5));color:var(--button-2-ink,var(--secondary-ink,#172033));box-shadow:var(--button-2-shadow,inset 0 -2px 0 oklch(from var(--secondary,#eef1f5) calc(l - .1) c h),var(--shadow-sm,0 1px 2px oklch(.22 .03 260 / .18)));cursor:pointer;transition:background .16s ease,transform .16s ease}
.cf-mega__toggle:hover{background:oklch(from var(--button-2-bg,var(--secondary,#eef1f5)) calc(l - .04) c h)}
.cf-mega__toggle:active{transform:translateY(1px)}
.cf-mega__panel{position:absolute;left:0;right:0;top:100%;background:var(--mm-card);border-bottom:1px solid var(--card-border,var(--mm-line));box-shadow:var(--shadow-lg,0 2px 3px oklch(.22 .03 260 / .22),0 12px 24px -8px oklch(.22 .03 260 / .32));padding-block:clamp(24px,3vw,36px) clamp(28px,3.4vw,40px);animation:cf-mega-drop .26s var(--mm-ease) both}
.cf-mega__panel[hidden]{display:none}
.cf-mega__panel .cf-mega__letter,.cf-mega__panel .cf-mega__offer-li,.cf-mega__panel .cf-mega__groups{animation:cf-mega-in .45s var(--mm-ease) both}
.cf-mega__panel .cf-mega__groups{animation-delay:.21s}
@keyframes cf-mega-drop{from{opacity:.82;transform:translateY(-6px)}to{opacity:1;transform:none}}
@keyframes cf-mega-in{from{opacity:.82;transform:translateY(8px)}to{opacity:1;transform:none}}
.cf-mega__split{display:grid;grid-template-columns:minmax(330px,400px) minmax(0,1fr);gap:clamp(24px,3vw,44px);align-items:start}
.cf-mega__split--solo{grid-template-columns:minmax(0,1fr)}
.cf-mega__browse{min-width:0}
.cf-mega__letter{--mm-soft:color-mix(in oklab,var(--mm-band-ink) 84%,var(--mm-band));background:var(--mm-band);color:var(--mm-band-ink);border-radius:var(--card-radius,var(--radius,14px));padding:clamp(22px,2.6vw,32px);box-shadow:inset 0 1px 0 oklch(from var(--mm-band-ink) l c h / .08)}
.cf-mega__letter :focus-visible{outline-color:oklch(from var(--mm-band-ink) l c h / .75)}
.cf-mega__salute{margin:0 0 12px;font-family:var(--font-display,inherit);font-weight:var(--display-weight,800);text-transform:var(--display-case,none);font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:1.15;letter-spacing:-0.01em}
.cf-mega__para{margin:0 0 12px;color:var(--mm-soft);font-size:1.0625rem;line-height:1.5;text-wrap:pretty}
.cf-mega__sign{display:flex;flex-direction:column;gap:2px;margin:16px 0 0;color:var(--mm-soft);font-size:.9375rem;line-height:1.4}
.cf-mega__sign strong{color:var(--mm-band-ink);font-family:var(--font-display,inherit);font-weight:var(--display-weight,800);font-size:1.125rem;letter-spacing:-0.01em}
.cf-mega__price{display:grid;grid-template-columns:auto minmax(0,1fr);align-items:center;column-gap:16px;row-gap:10px;margin:24px 0 16px;padding:16px 18px;border-radius:10px;background:oklch(from var(--mm-band-ink) l c h / .1)}
.cf-mega__fig{color:var(--mm-band-ink);font-family:var(--font-display,inherit);font-weight:var(--display-weight,800);font-size:clamp(2.5rem,3.4vw,2.875rem);line-height:1;letter-spacing:-0.03em;font-variant-numeric:tabular-nums}
.cf-mega__terms{display:flex;flex-direction:column;gap:2px;min-width:0;color:var(--mm-band-ink);font-size:.9375rem;font-weight:700;line-height:1.3;text-wrap:balance}
.cf-mega__anchor{grid-column:1/-1;color:var(--mm-soft);font-size:.9375rem;font-weight:500;line-height:1.4;text-wrap:pretty}
.cf-mega__assure{margin:14px 0 0;color:var(--mm-soft);text-align:center;font-size:.9375rem;font-weight:600;line-height:1.4;text-wrap:pretty}
.cf-mega__ico{display:inline-block;vertical-align:-0.15em;margin-inline-end:.4em}
.cf-mega__head{display:flex;align-items:baseline;justify-content:space-between;flex-wrap:wrap;gap:8px 16px;margin:0 0 12px;padding-inline:10px}
.cf-mega__heading{margin:0;color:var(--mm-ink);font-family:var(--font-display,inherit);font-weight:var(--display-weight,800);text-transform:var(--display-case,none);font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:1.15;letter-spacing:var(--display-tracking,-0.025em);text-wrap:balance}
.cf-mega__all{border-radius:4px;color:var(--link,var(--accent,#2563eb));font-size:.9375rem;font-weight:700;text-decoration:underline;text-decoration-color:oklch(from var(--link,var(--accent,#2563eb)) l c h / .45);text-underline-offset:.18em;white-space:nowrap}
.cf-mega__all:hover{color:oklch(from var(--link,var(--accent,#2563eb)) calc(l - .08) c h);text-decoration-color:currentColor}
.cf-mega__offers{display:grid;grid-template-columns:repeat(var(--cols,3),minmax(0,1fr));gap:12px}
.cf-mega__offer-li{display:flex}
.cf-mega__offer{display:flex;flex:1;flex-direction:column;padding:10px;border-radius:12px;color:var(--mm-ink);text-decoration:none;transition:background .16s ease}
.cf-mega__offer:hover{background:color-mix(in oklch,var(--mm-ink) 4%,var(--mm-card))}
.cf-mega__thumb{display:block;flex:none;aspect-ratio:5/4;margin-bottom:14px;border-radius:8px;overflow:hidden;background:color-mix(in oklch,var(--mm-ink) 5%,var(--mm-card))}
.cf-mega__thumb img{display:block;width:100%;height:100%;object-fit:cover;object-position:50% 35%;transition:transform .35s var(--mm-ease)}
.cf-mega__offer:hover .cf-mega__thumb img{transform:scale(1.04)}
.cf-mega__offer-text{display:flex;flex:1;flex-direction:column;min-width:0}
.cf-mega__offer-name{font-family:var(--font-display,inherit);font-weight:var(--display-weight,800);text-transform:var(--display-case,none);font-size:1.125rem;line-height:1.2;letter-spacing:-0.01em;text-wrap:balance;text-decoration:underline;text-decoration-color:transparent;text-underline-offset:.18em;transition:text-decoration-color .16s ease}
.cf-mega__offer:hover .cf-mega__offer-name{text-decoration-color:currentColor}
.cf-mega__offer-promise{margin-top:6px;color:var(--mm-muted);font-size:.9375rem;line-height:1.4;text-wrap:pretty}
.cf-mega__meta{display:flex;align-items:center;flex-wrap:wrap;gap:8px;min-height:28px;margin-top:auto;padding-top:14px;box-sizing:content-box}
.cf-mega__offer-price{color:var(--mm-ink);font-family:var(--font-display,inherit);font-weight:var(--display-weight,800);font-size:1.125rem;line-height:1;font-variant-numeric:tabular-nums}
.cf-mega__offer-price.is-free{color:var(--success,#15803d)}
.cf-mega__flag{display:inline-flex;align-items:center;min-height:28px;padding:4px 12px;border-radius:999px;background:var(--accent-fill,var(--accent,#2563eb));color:var(--accent-fill-ink,var(--card,#fff));font-size:.875rem;font-weight:800;line-height:1.2;white-space:nowrap}
.cf-mega__groups{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:20px 32px;margin-top:20px;padding:20px 24px;border-radius:12px;background:color-mix(in oklch,var(--mm-ink) 4%,var(--mm-card))}
.cf-mega__group-title{margin:0 0 8px;color:var(--mm-ink);font-size:.9375rem;font-weight:800;line-height:1.3}
.cf-mega__group a{display:inline-block;padding:4px 0;border-radius:6px;color:var(--mm-ink);font-size:1rem;font-weight:500;line-height:1.4;text-decoration:none}
.cf-mega__group a:hover{color:var(--link,var(--accent,#2563eb));text-decoration:underline;text-underline-offset:.18em}
.cf-mega__drawer{display:none}
@media (max-width:1199px) and (min-width:1040px){.cf-mega__bar{gap:16px}.cf-mega__links{gap:0}.cf-mega__item{padding:0 10px}}
@media (max-width:1039px){
.cf-mega__bar{min-height:64px;gap:12px}
.cf-mega__brand{font-size:1.125rem}
.cf-mega .cf-mega__links,.cf-mega .cf-mega__panel{display:none}
.cf-mega__end{margin-left:auto;gap:8px}
.cf-mega__toggle{display:inline-flex}
.cf-mega__btn--bar{min-height:44px;padding:0 16px;font-size:.9375rem}
.cf-mega__long{display:none}
.cf-mega__short{display:inline}
.cf-mega--drawer .cf-mega__btn--bar{display:none}
.cf-mega .cf-mega__drawer:not([hidden]){display:block;background:var(--mm-surface);border-top:1px solid var(--mm-line)}
.cf-mega--sticky .cf-mega__drawer:not([hidden]){max-height:calc(100dvh - 64px);overflow-y:auto;overscroll-behavior:contain}
.cf-mega__acc-item{border-bottom:1px solid var(--mm-line)}
.cf-mega__acc-btn{display:flex;align-items:center;justify-content:space-between;gap:12px;width:100%;min-height:60px;padding:0 4px;border:0;border-radius:var(--button-radius,8px);background:transparent;color:var(--mm-ink);font-family:var(--font-display,inherit);font-weight:var(--display-weight,800);font-size:1.125rem;line-height:1.2;letter-spacing:-0.01em;text-align:left;text-decoration:none;cursor:pointer}
.cf-mega__acc-body{display:grid;gap:20px;padding:4px 0 24px}
.cf-mega__acc-body[hidden]{display:none}
.cf-mega__acc-body .cf-mega__head{margin-bottom:4px}
.cf-mega__acc-body .cf-mega__heading{font-size:1.0625rem;letter-spacing:-0.01em}
.cf-mega__acc-body .cf-mega__all{font-size:.9375rem}
.cf-mega__acc-body .cf-mega__offers{grid-template-columns:minmax(0,1fr);gap:4px}
.cf-mega__acc-body .cf-mega__offer{flex-direction:row;align-items:flex-start;gap:14px}
.cf-mega__acc-body .cf-mega__thumb{width:76px;aspect-ratio:1;margin:0}
.cf-mega__acc-body .cf-mega__offer-name{font-size:1.0625rem}
.cf-mega__acc-body .cf-mega__meta{padding-top:8px}
.cf-mega__acc-body .cf-mega__groups{grid-template-columns:repeat(auto-fit,minmax(150px,1fr));margin-top:0;padding:16px 20px}
.cf-mega__letter--compact .cf-mega__price{margin:20px 0 16px}
.cf-mega__letter--compact .cf-mega__salute{margin-bottom:8px}
.cf-mega__drawer-cta{padding:20px 0 24px}
.cf-mega--sticky .cf-mega__drawer-cta{position:sticky;bottom:0;margin-inline:calc(-1 * var(--mm-gutter));padding:16px var(--mm-gutter) 20px;background:var(--mm-surface);border-top:1px solid var(--mm-line)}
.cf-mega__note{margin-top:10px;color:var(--mm-muted);text-align:center;font-size:.9375rem;font-weight:600;line-height:1.4;text-wrap:pretty}
}
@media (max-width:359px){.cf-mega .cf-mega__btn--bar{display:none}}
@media (prefers-reduced-motion:reduce){
.cf-mega *,.cf-mega *::before,.cf-mega *::after{transition:none}
.cf-mega .cf-mega__panel,.cf-mega .cf-mega__panel *{animation:none}
.cf-mega .cf-mega__btn:hover,.cf-mega .cf-mega__btn:active,.cf-mega .cf-mega__toggle:active,.cf-mega .cf-mega__offer:hover .cf-mega__thumb img{transform:none}
}
`
pieces/nav/mega-menu/specimen.tsx 121 lines
// Specimen: the mega menu with the Programs panel open on desktop and the phone drawer open on Programs.
import __studioImage8f6099cf from "../assets/63eba69f28cffa90.webp";
import __studioImage96a1a057 from "../assets/630318f86753dbc5.webp";
import * as React from 'react'
import { MegaMenu, type MegaMenuItem } from '../mega-menu'
import defaults from '../../studio-defaults.json'
import { slot } from '../../slots'
export const states = ['default']
export default function MegaMenuSpecimen(_props: { state?: string }) {
const s = defaults.sample
const r = s.registration
const [guide, workbook, checklist] = s.items
const team = 'The Funnel Starter team'
const items: MegaMenuItem[] = [
{
id: 'programs',
label: 'Programs',
panel: {
heading: 'Start with the piece you need tonight',
allLabel: 'Compare all programs',
allHref: '#programs',
featured: {
salutation: 'Dear friend,',
body: [
'If your funnel is still a blank page, start here.',
'The Funnel Starter Kit gives you the guide, the workbook and the checklist in one download. Plan it tonight, then build it page by page.',
],
signoff: 'To your first launch,',
signer: team,
price: s.price,
priceNote: s.note,
anchor: 'vs. hiring a copywriter to write your pages',
label: `Try It Risk-Free · ${s.price}`,
reassurance: s.guarantee,
href: '#checkout',
},
offers: [
{ name: s.name, promise: 'Plan, write and check your funnel before you launch.', price: s.price, flag: 'Start here', href: '#kit', image: slot('item-1', guide.image), imageAlt: guide.imageAlt },
{ name: workbook.name, promise: workbook.detail, price: workbook.value, href: '#workbook', image: slot('item-2', workbook.image), imageAlt: workbook.imageAlt },
{ name: checklist.name, promise: checklist.detail, price: checklist.value, href: '#checklist', image: slot('item-3', checklist.image), imageAlt: checklist.imageAlt },
],
groups: [
{ title: 'Plan it tonight', links: [{ label: guide.name, href: '#guide' }, { label: 'Map the pages you need', href: '#pages' }, { label: 'Pick your one offer', href: '#offer' }] },
{ title: 'Write pages that sell', links: [{ label: workbook.name, href: '#workbook' }, { label: 'Headline starters', href: '#headlines' }, { label: 'Call-to-action lines', href: '#cta-lines' }] },
{ title: 'Launch with confidence', links: [{ label: checklist.name, href: '#checklist' }, { label: 'Test every link and form', href: '#testing' }, { label: 'Our 30-day guarantee', href: '#guarantee' }] },
],
},
},
{
id: 'free-training',
label: 'Free Training',
panel: {
heading: 'Learn the plan before you build',
allLabel: 'See all free training',
allHref: '#free-training',
featured: {
salutation: 'Dear friend,',
body: [
`Before you build a single page, watch the free ${r.name}.`,
'Walk through your offer, your page copy and your next steps, so you start with a plan.',
],
signoff: 'See you inside,',
signer: team,
price: 'Free',
free: true,
priceNote: 'On-demand workshop',
anchor: 'vs. guessing your way through launch',
label: r.label,
reassurance: r.privacy,
href: '#register',
},
offers: [
{
name: r.name,
promise: 'Map your offer, page copy and next steps.',
price: 'Free',
free: true,
flag: 'Watch first',
href: '#workshop',
image: slot('item-4', __studioImage8f6099cf),
imageAlt: 'Laptop playing the Funnel Starter Workshop on a bright desk',
},
{
name: 'Offer Clarity Lesson',
promise: 'Say what you sell in one clear sentence.',
price: 'Free',
free: true,
href: '#lesson',
image: slot('item-5', __studioImage96a1a057),
imageAlt: 'Hands writing offer notes beside a laptop',
},
],
groups: [
{ title: 'Watch and learn', links: [{ label: r.name, href: '#workshop' }, { label: 'Offer Clarity Lesson', href: '#lesson' }] },
{ title: 'Ready for the full plan?', links: [{ label: `See ${s.name}`, href: '#kit' }, { label: 'Compare what’s inside', href: '#programs' }] },
],
},
},
{ id: 'results', label: 'Results', href: '#results' },
{ id: 'resources', label: 'Resources', href: '#resources' },
{ id: 'about', label: 'About', href: '#about' },
]
return (
<div className='cf-mega-specimen'>
{/* Room for the absolutely positioned desktop panel; no background, tokens or fonts */}
<style>{`.cf-mega-specimen{min-height:740px}@media (max-width:1039px){.cf-mega-specimen{min-height:0}}`}</style>
<MegaMenu
brand='Funnel Starter'
logoImage={slot('logo', '') || undefined}
items={items}
cta={{ label: 'Save My Free Seat', shortLabel: 'Save My Seat', href: '#register', note: r.sublabel }}
defaultOpen='programs'
defaultMenuOpen
/>
</div>
)
}
| Name | Type | Details |
|---|---|---|
brand OptionalMegaMenu |
string |
|
brandHref OptionalMegaMenu |
string |
|
logoImage OptionalMegaMenu |
string |
|
logoAlt OptionalMegaMenu |
string |
|
items OptionalMegaMenu |
MegaMenuItem[] |
|
cta OptionalMegaMenu |
MegaMenuCta |
|
sticky OptionalMegaMenu |
boolean |
|
defaultOpen OptionalMegaMenu |
string |
|
defaultMenuOpen OptionalMegaMenu |
boolean |
|
hoverDelay OptionalMegaMenu |
number |
|
closeDelay OptionalMegaMenu |
number |
|
onAction OptionalMegaMenu |
(action: MegaMenuAction) => void |
|
copy OptionalMegaMenu |
Partial<MegaMenuCopy> |
|
className OptionalMegaMenu |
string |
Theme roles it reads
Set by the theme bar, a preset or your brand. Colours come from the base tokens (--surface, --ink, --cta…) every piece uses.
--button-bg--button-bg-2--button-case--button-font--button-ink--button-radius--button-shadow--button-text-shadow--button-weight- Main CTA button: background, ink, font, weight, case, radius and shadow.
--button-2-bg--button-2-border--button-2-ink--button-2-shadow- Secondary button.
--card-border--card-radius- Cards and panels: radius, border and shadow.
--display-case--display-tracking--display-weight- Headlines: weight, letter case and tracking.
--field-focus- Form inputs: background, ink, border, radius and focus colour.
Image slots
Filled from the brand’s images; the specimen ships its own defaults.
item-1- One image per offer item (item-1, item-2…), shown in stacks and lists.
item-2- One image per offer item (item-1, item-2…), shown in stacks and lists.
item-3- One image per offer item (item-1, item-2…), shown in stacks and lists.
item-4- One image per offer item (item-1, item-2…), shown in stacks and lists.
item-5- One image per offer item (item-1, item-2…), shown in stacks and lists.
logo- The brand’s logo mark.
-
630318f86753dbc5.webp
image/webp · 150 KB
-
63eba69f28cffa90.webp
image/webp · 70.7 KB
-
b77916eca54aa689.webp
image/webp · 8.32 KB
-
d435db6662febfcf.webp
image/webp · 10 KB
-
f0a5d3e1e61804ba.webp
image/webp · 11.6 KB