About
Navigation item that displays a full-width mega menu panel on hover. Uses a slots API with items and featured props. TopNavMegaMenuItem renders itself in both desktop and mobile drawer modes. Supports inline collapsible drawer via render mode context. Astryx by Meta. Source: https://astryx.atmeta.com/components/TopNavMegaMenu
Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Astryx Top Nav Mega Menu to your project and fits it to your theme.
Code
How Astryx Top Nav Mega Menu is used: the demo's code. The component's own source comes with a free account.
Usage.tsx
'use client';
/* Copyright (c) 2026 Meta Platforms, Inc. See the MIT notice in astryx-top-nav-mega-menu.tsx. */
import '@/components/ui/astryx-top-nav-mega-menu-utils/astryx-preview.css';
import '@astryxdesign/theme-neutral/fonts.css';
import {useSyncExternalStore} from 'react';
import {Theme} from '@astryxdesign/core/theme';
import {neutralTheme} from '@astryxdesign/theme-neutral/built';
import {
TopNav,
TopNavHeading,
TopNavItem,
TopNavMegaMenu,
TopNavMegaMenuItem,
TopNavMegaMenuFeaturedCard,
} from '@/components/ui/astryx-top-nav-mega-menu';
import {
RocketLaunchIcon as RocketIcon,
BookOpenIcon as BookIcon,
CodeBracketIcon as CodeIcon,
ShieldCheckIcon as ShieldIcon,
MagnifyingGlassIcon as SearchIcon,
} from '@heroicons/react/24/outline';
function OfficialSample() {
return (
<TopNav
style={{width: 600, maxWidth: '100%'}}
label="Mega menu demo"
heading={<TopNavHeading heading="DevTools" />}
startContent={
<>
<TopNavItem label="Overview" href="#" isSelected />
<TopNavMegaMenu
label="Products"
items={
<>
<TopNavMegaMenuItem
title="Deploy"
description="Ship to production in seconds"
icon={<RocketIcon width={20} height={20} />}
href="#deploy"
/>
<TopNavMegaMenuItem
title="Documentation"
description="Guides, references, and tutorials"
icon={<BookIcon width={20} height={20} />}
href="#docs"
/>
<TopNavMegaMenuItem
title="API"
description="Programmatic access to all features"
icon={<CodeIcon width={20} height={20} />}
href="#api"
/>
<TopNavMegaMenuItem
title="Security"
description="Enterprise-grade protection"
icon={<ShieldIcon width={20} height={20} />}
href="#security"
/>
</>
}
featured={
<TopNavMegaMenuFeaturedCard
title="What's New"
description="Check out our latest features and improvements in the Q2 release."
linkLabel="Read the changelog"
linkHref="#changelog"
/>
}
/>
</>
}
endContent={<SearchIcon width={20} height={20} />}
/>
);
}
function readPreviewMode() {
const {classList} = document.documentElement;
return classList.contains('dark') ? 'dark' : 'light';
}
function subscribeToPreviewMode(callback: () => void) {
const observer = new MutationObserver(callback);
observer.observe(document.documentElement, {attributes: true, attributeFilter: ['class']});
return () => observer.disconnect();
}
export default function Demo() {
const mode = useSyncExternalStore(subscribeToPreviewMode, readPreviewMode, () => 'light' as const);
return (
<Theme theme={neutralTheme} mode={mode}>
<div className="astryx-demo">
<div className="astryx-demo-content" data-centered style={{maxWidth: 600}}>
<OfficialSample />
</div>
</div>
</Theme>
);
}















