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















