David Hakobyana

Astryx Top Nav Menu

Navigation

About

Navigation item that displays a hover-triggered popover menu with rich items containing an icon, title, and optional description. Astryx by Meta. Source: https://astryx.atmeta.com/components/TopNavMenu

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Astryx Top Nav Menu to your project and fits it to your theme.

Code

How Astryx Top Nav 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-menu.tsx. */

import '@/components/ui/astryx-top-nav-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,
  TopNavMenu,
} from '@/components/ui/astryx-top-nav-menu';
import {Button} from '@astryxdesign/core/Button';
import {useToast} from '@astryxdesign/core/Toast';
import {
  ChartBarIcon as ChartIcon,
  Cog6ToothIcon as SettingsIcon,
  MagnifyingGlassIcon as SearchIcon,
  UsersIcon,
} from '@heroicons/react/24/outline';

function OfficialSample() {
  const showToast = useToast();
  return (
    <TopNav
      style={{width: '100%', minWidth: 0}}
      label="Menu demo"
      heading={<TopNavHeading heading="Platform" />}
      startContent={
        <>
          <TopNavItem label="Home" href="#" isSelected />
          <TopNavMenu
            label="Tools"
            items={[
              {
                title: 'Analytics',
                description: 'View traffic and engagement metrics',
                icon: <ChartIcon />,
                href: '#analytics',
              },
              {
                title: 'Team Members',
                description: 'Manage your team and permissions',
                icon: <UsersIcon />,
                href: '#team',
              },
              {
                title: 'Settings',
                description: 'Configure your workspace',
                icon: <SettingsIcon />,
                href: '#settings',
              },
            ]}
          />
        </>
      }
      endContent={
        <Button
          label="Search"
          variant="ghost"
          icon={<SearchIcon />}
          isIconOnly
          onClick={() => showToast({body: 'Demo: search would open here'})}
        />
      }
    />
  );
}

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>
  );
}

Dependencies

More by David Hakobyana

View all
  • Futuristic Hero

    Futuristic Hero

    2.7K
  • Hero ASCII one

    Hero ASCII one

    1.4K
  • Hero ASCII

    Hero ASCII

    1.4K
  • Admit One Ticket

    Admit One Ticket

    1.2K
  • Border Beam

    Border Beam

    1.1K
  • Navigation Menu

    Navigation Menu

    1K
  • Border Beam Search

    Border Beam Search

    742
  • Thinking Orbs

    Thinking Orbs

    534

More in Navigation

View all
  • Footer with Big Wordmark

    Footer with Big Wordmark

    179
  • Liquid Glass Expandable Sidebar

    Liquid Glass Expandable Sidebar

    452
  • Meniscus — Liquid Bottom Navigation Bar

    Meniscus — Liquid Bottom Navigation Bar

    37
  • Sidebar

    Sidebar

    444
  • Tabs

    Tabs

    38
  • Stacked Circular Footer

    Stacked Circular Footer

    470
  • Sidebar

    Sidebar

    367
  • Footer

    Footer

    470