Astryx

Astryx Dropdown Menu Group

Component 2

About

A group of rows in a compound menu. A visible title names role="group" through aria-labelledby; an omitted title leaves the group unnamed. The heading is not a menuitem, so arrow keys and typeahead skip it. Keep title content non-interactive and place controls in DropdownMenu header or footer. The data-driven equivalent is the `{type: "section", title, items}` entry in `items`; both forms share the heading treatment and theme target. Host attributes and DOM handlers (id, data-*, aria-*) reach the group element; its role, and its name while it has a title, stay component-owned. Astryx by Meta. Source: https://astryx.atmeta.com/components/DropdownMenuGroup

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

Code

How Astryx Dropdown Menu Group 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-dropdown-menu-group.tsx. */

import '@/components/ui/astryx-dropdown-menu-group-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 {
  DropdownMenu,
  DropdownMenuDivider,
  DropdownMenuGroup,
  DropdownMenuItem,
} from '@/components/ui/astryx-dropdown-menu-group';
import {useToast} from '@astryxdesign/core/Toast';

function OfficialSample() {
  const showToast = useToast();
  return (
    <DropdownMenu button={{label: 'Version'}}>
      <DropdownMenuGroup title="Version history">
        <DropdownMenuItem
          icon="arrowDown"
          label="Restore this version"
          onClick={() =>
            showToast({body: 'Demo: this version would be restored here'})
          }
        />
        <DropdownMenuItem
          icon="copy"
          label="Compare with current"
          onClick={() =>
            showToast({
              body: 'Demo: a comparison with the current version would open here',
            })
          }
        />
      </DropdownMenuGroup>
      <DropdownMenuDivider />
      <DropdownMenuGroup title="Add to message">
        <DropdownMenuItem
          icon="externalLink"
          label="As a link"
          onClick={() =>
            showToast({
              body: 'Demo: a link would be added to your message here',
            })
          }
        />
        <DropdownMenuItem
          label="As a snippet"
          onClick={() =>
            showToast({
              body: 'Demo: a snippet would be added to your message here',
            })
          }
        />
      </DropdownMenuGroup>
    </DropdownMenu>
  );
}

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: 410}}>
          <OfficialSample />
        </div>
      </div>
    </Theme>
  );
}

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

    28
  • Astryx Toggle Button

    Astryx Toggle Button

    17
  • Astryx Chat Tokenized Text

    Astryx Chat Tokenized Text

    12