Astryx

Astryx Dropdown Menu Submenu

Navigation

About

A single menu row that reveals a nested flyout of its own items. The row adopts DropdownMenuItem semantics (label / icon / description / isDisabled); its children become the flyout content. Opens inline-end with viewport auto-flip; Right/Enter/Space opens and focuses the first item, Left/Escape closes and returns focus to the trigger (Right/Left swap in RTL). On a phone (a coarse pointer, decided when the menu opened) the row drills in instead: its rows replace the menu's rows in the same box, led by a Back row named "Back to <parent>", and Back, Escape or ArrowLeft return to the row. Host attributes and DOM event handlers (aria-*, data-*, id) reach the trigger row, the element carrying role="menuitem" and aria-haspopup="menu"; a caller's handlers run after the row's own, except for the keys that open the flyout (the open arrow, Enter, Space) and a click on a disabled row. For data-driven menus, give a menu item a nested `items` array instead of using this component directly. Astryx by Meta. Source: https://astryx.atmeta.com/components/DropdownMenuSubMenu

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

Code

How Astryx Dropdown Menu Submenu 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 MIT notice in astryx-dropdown-menu-sub-menu.tsx. */

import '@/components/ui/astryx-dropdown-menu-sub-menu-utils/astryx-preview.css';
import {useState} from 'react';
import {
  DropdownMenu,
  DropdownMenuItem,
  DropdownMenuSubMenu,
} from '@/components/ui/astryx-dropdown-menu-sub-menu';
import {VStack} from '@astryxdesign/core/Layout';
import {Text} from '@astryxdesign/core/Text';

function OfficialSample() {
  const [lastAction, setLastAction] = useState<string | null>(null);

  return (
    <VStack gap={3}>
      <DropdownMenu button={{label: 'Actions'}}>
        <DropdownMenuItem
          icon="pencil"
          label="Rename"
          onClick={() => setLastAction('Rename')}
        />
        <DropdownMenuSubMenu icon="folder" label="Move to">
          <DropdownMenuItem
            label="Projects"
            onClick={() => setLastAction('Move to Projects')}
          />
          <DropdownMenuItem
            label="Archive"
            onClick={() => setLastAction('Move to Archive')}
          />
          <DropdownMenuItem
            label="Trash"
            onClick={() => setLastAction('Move to Trash')}
          />
        </DropdownMenuSubMenu>
        <DropdownMenuItem
          icon="trash"
          label="Delete"
          onClick={() => setLastAction('Delete')}
        />
      </DropdownMenu>
      {lastAction && (
        <Text type="supporting" color="secondary">
          Last action: {lastAction}
        </Text>
      )}
    </VStack>
  );
}

export default function Demo() {
  return (
    <div className="astryx-demo" data-astryx-theme="neutral" data-theme="light">
      <div className="astryx-demo-content" data-centered style={{maxWidth: 450}}>
        <OfficialSample />
      </div>
    </div>
  );
}

Dependencies

More by Astryx

View all
  • Astryx Banner

    Astryx Banner

    61
  • Astryx Avatar

    Astryx Avatar

    34
  • Astryx Aspect Ratio

    Astryx Aspect Ratio

    32
  • Astryx Badge

    Astryx Badge

    30
  • Astryx Button Group

    Astryx Button Group

    29
  • Astryx Chat Composer Drawer

    Astryx Chat Composer Drawer

    27
  • Astryx Toggle Button

    Astryx Toggle Button

    17
  • Astryx Chat Tokenized Text

    Astryx Chat Tokenized Text

    12

More in Navigation

View all
  • Footer with Big Wordmark

    Footer with Big Wordmark

    151
  • Liquid Glass Expandable Sidebar

    Liquid Glass Expandable Sidebar

    391
  • Sidebar

    Sidebar

    437
  • Menu

    Menu

    2
  • Footer Section

    Footer Section

    1
  • Tabs

    Tabs

    35
  • Meniscus — Liquid Bottom Navigation Bar

    Meniscus — Liquid Bottom Navigation Bar

    12
  • Pagination

    Pagination

    118