Skip to content

An open source design system that's fully customizable and agent ready

TypeScript

feat(core): add XDSMoreMenu — overflow menu with three-dot trigger (#439)

Cindy Zhang437d72cad3ea
diff --git a/apps/storybook/stories/MoreMenu.stories.tsx b/apps/storybook/stories/MoreMenu.stories.tsx
new file mode 100644
index 0000000000..6106bc246b
--- /dev/null
+++ b/apps/storybook/stories/MoreMenu.stories.tsx
@@ -0,0 +1,292 @@
+import type {Meta, StoryObj} from '@storybook/react';
+import {XDSMoreMenu} from '@xds/core/MoreMenu';
+import {XDSDropdownMenuItem} from '@xds/core/DropdownMenu';
+import {XDSButton} from '@xds/core/Button';
+import {
+ PencilIcon,
+ TrashIcon,
+ DocumentDuplicateIcon,
+ ArrowDownTrayIcon,
+ ShareIcon,
+} from '@heroicons/react/24/outline';
+
+const meta: Meta<typeof XDSMoreMenu> = {
+ title: 'Core/XDSMoreMenu',
+ component: XDSMoreMenu,
+ tags: ['autodocs'],
+ parameters: {
+ layout: 'centered',
+ },
+ argTypes: {
+ items: {
+ description: 'Menu items (items, dividers, or sections)',
+ },
+ label: {
+ control: 'text',
+ description: 'Accessible label for the trigger button',
+ },
+ variant: {
+ control: 'select',
+ options: ['primary', 'secondary', 'ghost', 'destructive'],
+ description: 'Visual style variant of the trigger button',
+ },
+ size: {
+ control: 'select',
+ options: ['sm', 'md', 'lg'],
+ description: 'Size of the trigger button',
+ },
+ isDisabled: {
+ control: 'boolean',
+ description: 'Whether the menu trigger is disabled',
+ },
+ 'data-testid': {
+ control: 'text',
+ description: 'Test ID for testing frameworks',
+ },
+ },
+};
+
+export default meta;
+type Story = StoryObj<typeof XDSMoreMenu>;
+
+// Basic usage — just items, all defaults
+export const Default: Story = {
+ render: () => (
+ <XDSMoreMenu
+ items={[
+ {label: 'Edit', onClick: () => console.log('Edit clicked')},
+ {label: 'Duplicate', onClick: () => console.log('Duplicate clicked')},
+ {label: 'Delete', onClick: () => console.log('Delete clicked')},
+ ]}
+ />
+ ),
+};
+
+// With icons on items
+export const WithIcons: Story = {
+ render: () => (
+ <XDSMoreMenu
+ items={[
+ {
+ label: 'Edit',
+ icon: PencilIcon,
+ onClick: () => console.log('Edit'),
+ },
+ {
+ label: 'Duplicate',
+ icon: DocumentDuplicateIcon,
+ onClick: () => console.log('Duplicate'),
+ },
+ {
+ label: 'Download',
+ icon: ArrowDownTrayIcon,
+ onClick: () => console.log('Download'),
+ },
+ {
+ label: 'Share',
+ icon: ShareIcon,
+ onClick: () => console.log('Share'),
+ },
+ ]}
+ />
+ ),
+};
+
+// With dividers
+export const WithDividers: Story = {
+ render: () => (
+ <XDSMoreMenu
+ items={[
+ {
+ label: 'Edit',
+ icon: PencilIcon,
+ onClick: () => console.log('Edit'),
+ },
+ {
+ label: 'Duplicate',
+ icon: DocumentDuplicateIcon,
+ onClick: () => console.log('Duplicate'),
+ },
+ {type: 'divider'},
+ {
+ label: 'Delete',
+ icon: TrashIcon,
+ onClick: () => console.log('Delete'),
+ },
+ ]}
+ />
+ ),
+};
+
+// With sections
+export const WithSections: Story = {
+ render: () => (
+ <XDSMoreMenu
+ label="Document actions"
+ items={[
+ {
+ type: 'section',
+ title: 'Actions',
+ items: [
+ {
+ label: 'Edit',
+ icon: PencilIcon,
+ onClick: () => console.log('Edit'),
+ },
+ {
+ label: 'Duplicate',
+ icon: DocumentDuplicateIcon,
+ onClick: () => console.log('Duplicate'),
+ },
+ ],
+ },
+ {
+ type: 'section',
+ title: 'Danger zone',
+ items: [
+ {
+ label: 'Delete',
+ icon: TrashIcon,
+ onClick: () => console.log('Delete'),
+ },
+ ],
+ },
+ ]}
+ />
+ ),
+};
+
+// Small size — for table rows and dense layouts
+export const SmallSize: Story = {
+ render: () => (
+ <XDSMoreMenu
+ size="sm"
+ label="Row actions"
+ items={[
+ {
+ label: 'Edit',
+ icon: PencilIcon,
+ onClick: () => console.log('Edit'),
+ },
+ {type: 'divider'},
+ {
+ label: 'Delete',
+ icon: TrashIcon,
+ onClick: () => console.log('Delete'),
+ },
+ ]}
+ />
+ ),
+};
+
+// Different variants
+export const Variants: Story = {
+ render: () => (
+ <div style={{display: 'flex', gap: 16, alignItems: 'center'}}>
+ <XDSMoreMenu
+ variant="ghost"
+ label="Ghost variant"
+ items={[{label: 'Action', onClick: () => {}}]}
+ />
+ <XDSMoreMenu
+ variant="secondary"
+ label="Secondary variant"
+ items={[{label: 'Action', onClick: () => {}}]}
+ />
+ <XDSMoreMenu
+ variant="primary"
+ label="Primary variant"
+ items={[{label: 'Action', onClick: () => {}}]}
+ />
+ </div>
+ ),
+};
+
+// Disabled state
+export const Disabled: Story = {
+ render: () => (
+ <XDSMoreMenu
+ isDisabled
+ items={[
+ {label: 'Edit', onClick: () => console.log('Edit')},
+ {label: 'Delete', onClick: () => console.log('Delete')},
+ ]}
+ />
+ ),
+};
+
+// In a toolbar alongside other buttons
+export const InToolbar: Story = {
+ render: () => (
+ <div style={{display: 'flex', gap: 8, alignItems: 'center'}}>
+ <XDSButton label="Save" variant="primary" onClick={() => {}} />
+ <XDSButton label="Preview" variant="secondary" onClick={() => {}} />
+ <XDSMoreMenu
+ label="More actions"
+ items={[
+ {
+ label: 'Export',
+ icon: ArrowDownTrayIcon,
+ onClick: () => console.log('Export'),
+ },
+ {
+ label: 'Share',
+ icon: ShareIcon,
+ onClick: () => console.log('Share'),
+ },
+ {type: 'divider'},
+ {
+ label: 'Delete',
+ icon: TrashIcon,
+ onClick: () => console.log('Delete'),
+ },
+ ]}
+ />
+ </div>
+ ),
+};
+
+// With custom item rendering
+export const CustomItemRendering: Story = {
+ render: () => (
+ <XDSMoreMenu
+ label="User actions"
+ items={[
+ {label: 'Alice Johnson', onClick: () => console.log('Alice')},
+ {label: 'Bob Smith', onClick: () => console.log('Bob')},
+ {label: 'Carol Williams', onClick: () => console.log('Carol')},
+ ]}>
+ {item => (
+ <XDSDropdownMenuItem label={item.label} description="Team member" />
+ )}
+ </XDSMoreMenu>
+ ),
+};
+
+// With disabled items
+export const WithDisabledItems: Story = {
+ render: () => (
+ <XDSMoreMenu
+ items={[
+ {
+ label: 'Edit',
+ icon: PencilIcon,
+ onClick: () => console.log('Edit'),
+ },
+ {
+ label: 'Duplicate',
+ icon: DocumentDuplicateIcon,
+ onClick: () => console.log('Duplicate'),
+ isDisabled: true,
+ },
+ {type: 'divider'},
+ {
+ label: 'Delete',
+ icon: TrashIcon,
+ onClick: () => console.log('Delete'),
+ isDisabled: true,
+ },
+ ]}
+ />
+ ),
+};
diff --git a/packages/core/src/Icon/IconRegistry.tsx b/packages/core/src/Icon/IconRegistry.tsx
index 2549c6d36d..95e5142f2c 100644
--- a/packages/core/src/Icon/IconRegistry.tsx
+++ b/packages/core/src/Icon/IconRegistry.tsx
@@ -38,7 +38,8 @@ export type XDSIconName =
| 'calendar'
| 'clock'
| 'externalLink'
- | 'menu';
+ | 'menu'
+ | 'moreHorizontal';
/**
* Icon registry mapping semantic names to React nodes.
diff --git a/packages/core/src/Icon/defaultIcons.tsx b/packages/core/src/Icon/defaultIcons.tsx
index ab4ae4c61e..bedcd4166c 100644
--- a/packages/core/src/Icon/defaultIcons.tsx
+++ b/packages/core/src/Icon/defaultIcons.tsx
@@ -160,4 +160,13 @@ export const defaultIcons: XDSIconRegistry = {
<path d="M4 6h16M4 12h16M4 18h16" />
</svg>
),
+
+ /** ⋯ — three horizontal dots (more/overflow) */
+ moreHorizontal: (
+ <svg {...solidSvgProps}>
+ <circle cx="5" cy="12" r="1.5" />
+ <circle cx="12" cy="12" r="1.5" />
+ <circle cx="19" cy="12" r="1.5" />
+ </svg>
+ ),
};
diff --git a/packages/core/src/MoreMenu/README.md b/packages/core/src/MoreMenu/README.md
new file mode 100644
index 0000000000..99200516f4
--- /dev/null
+++ b/packages/core/src/MoreMenu/README.md
@@ -0,0 +1,155 @@
+# MoreMenu
+
+Overflow menu with a three-dot icon trigger. A convenience wrapper that composes an icon-only XDSButton with a dropdown menu, eliminating the boilerplate of wiring up state management, positioning, and accessibility attributes.
+
+<!-- SYNC: When files in this directory change, update this document. -->
+
+## Features
+
+- **Zero-config defaults**: Three-dot icon, "More options" label, ghost variant — just pass `items`
+- **Data-driven items**: Same `items` prop as XDSDropdownMenu (items, dividers, sections)
+- **Icon-only trigger**: Always renders as a square icon button with aria-label
+- **Keyboard navigation**: Full keyboard support (Arrow keys, Home, End, Enter, Space, Escape)
+- **Accessibility**: Proper ARIA roles (`menu`, `menuitem`), `aria-haspopup`, `aria-expanded`
+- **Tooltip**: Shows label on hover, hidden when menu is open
+- **Custom rendering**: Optional `children` render function for custom item content
+
+## Usage
+
+```tsx
+import {XDSMoreMenu} from '@xds/core/MoreMenu';
+
+// Minimal — just actions
+<XDSMoreMenu
+ items={[
+ { label: 'Edit', onClick: handleEdit },
+ { label: 'Delete', onClick: handleDelete },
+ ]}
+/>
+
+// With custom label and size (e.g., table row actions)
+<XDSMoreMenu
+ label="Row actions"
+ size="sm"
+ items={[
+ { label: 'Edit', icon: PencilIcon, onClick: () => handleEdit(row) },
+ { type: 'divider' },
+ { label: 'Delete', icon: TrashIcon, onClick: () => handleDelete(row) },
+ ]}
+/>
+
+// With sections
+<XDSMoreMenu
+ label="Document actions"
+ items={[
+ {
+ type: 'section',
+ title: 'Actions',
+ items: [
+ { label: 'Edit', onClick: handleEdit },
+ { label: 'Duplicate', onClick: handleDuplicate },
+ ],
+ },
+ {
+ type: 'section',
+ title: 'Danger zone',
+ items: [
+ { label: 'Delete', onClick: handleDelete },
+ ],
+ },
+ ]}
+/>
+
+// With custom item rendering
+<XDSMoreMenu
+ label="User actions"
+ items={actions}
+>
+ {item => (
+ <XDSDropdownMenuItem
+ icon={item.icon}
+ label={item.label}
+ description={item.description}
+ />
+ )}
+</XDSMoreMenu>
+```
+
+## Composition Stories
+
+### Table row actions
+
+```tsx
+<td>
+ <XDSMoreMenu
+ size="sm"
+ label="Row actions"
+ items={[
+ {label: 'Edit', icon: PencilIcon, onClick: () => handleEdit(row)},
+ {type: 'divider'},
+ {label: 'Delete', icon: TrashIcon, onClick: () => handleDelete(row)},
+ ]}
+ />
+</td>
+```
+
+### Card header
+
+```tsx
+<div
+ style={{
+ display: 'flex',
+ alignItems: 'center',
+ justifyContent: 'space-between',
+ }}>
+ <XDSHeading level={3}>Card Title</XDSHeading>
+ <XDSMoreMenu
+ items={[
+ {label: 'Edit', onClick: handleEdit},
+ {label: 'Duplicate', onClick: handleDuplicate},
+ {type: 'divider'},
+ {label: 'Delete', onClick: handleDelete},
+ ]}
+ />
+</div>
+```
+
+### Toolbar (alongside other buttons)
+
+```tsx
+<div style={{display: 'flex', gap: 8}}>
+ <XDSButton label="Save" variant="primary" />
+ <XDSButton label="Preview" variant="secondary" />
+ <XDSMoreMenu label="More actions" items={overflowActions} />
+</div>
+```
+
+## Props
+
+### XDSMoreMenu
+
+| Prop | Type | Default | Description |
+| ------------- | ---------------------------------------------- | ---------------- | ---------------------------------------------- |
+| `items` | `XDSDropdownMenuOption[]` | — | Menu items (items, dividers, or sections) |
+| `label` | `string` | `'More options'` | Accessible label (aria-label) and tooltip text |
+| `variant` | `XDSButtonVariant` | `'ghost'` | Visual style variant of the trigger button |
+| `size` | `XDSButtonSize` | `'md'` | Size of the trigger button |
+| `icon` | `ReactNode` | Three-dot icon | Override the default three-dot icon |
+| `isDisabled` | `boolean` | `false` | Whether the menu trigger is disabled |
+| `children` | `(item: XDSDropdownMenuItemData) => ReactNode` | — | Custom render function for items |
+| `data-testid` | `string` | — | Test ID for testing frameworks |
+
+## When to use XDSMoreMenu vs XDSDropdownMenu
+
+- **XDSMoreMenu**: Icon-only trigger (three dots), no visible label. Best for overflow actions in tight spaces (table rows, card headers, list items).
+- **XDSDropdownMenu**: Labeled trigger button with chevron. Best for primary dropdown selections (file menus, action selectors).
+
+For full control over the trigger or menu content, compose `XDSButton` + `useXDSLayer` + `XDSDropdownMenuItem` directly.
+
+## Files
+
+| File | Role | Purpose |
+| ---------------------- | ------- | ----------------------------- |
+| `index.ts` | Entry | Exports component and types |
+| `XDSMoreMenu.tsx` | Core | Main component implementation |
+| `XDSMoreMenu.test.tsx` | Testing | Unit tests |
diff --git a/packages/core/src/MoreMenu/XDSMoreMenu.test.tsx b/packages/core/src/MoreMenu/XDSMoreMenu.test.tsx
new file mode 100644
index 0000000000..e55c91de59
--- /dev/null
+++ b/packages/core/src/MoreMenu/XDSMoreMenu.test.tsx
@@ -0,0 +1,187 @@
+/**
+ * @file XDSMoreMenu.test.tsx
+ * @input Uses vitest, @testing-library/react, XDSMoreMenu component
+ * @output Unit tests for XDSMoreMenu component behavior
+ * @position Testing; validates XDSMoreMenu.tsx implementation
+ *
+ * SYNC: When XDSMoreMenu.tsx changes, update tests to match new behavior
+ */
+
+import {describe, it, expect, vi, beforeEach} from 'vitest';
+import {render, screen} from '@testing-library/react';
+import userEvent from '@testing-library/user-event';
+import {XDSMoreMenu} from './XDSMoreMenu';
+
+// Mock showPopover and hidePopover methods since they're not implemented in jsdom
+beforeEach(() => {
+ HTMLElement.prototype.showPopover = vi.fn(function (this: HTMLElement) {
+ this.setAttribute('popover-open', '');
+ const event = new Event('toggle', {bubbles: false});
+ Object.defineProperty(event, 'newState', {value: 'open'});
+ this.dispatchEvent(event);
+ });
+ HTMLElement.prototype.hidePopover = vi.fn(function (this: HTMLElement) {
+ this.removeAttribute('popover-open');
+ const event = new Event('toggle', {bubbles: false});
+ Object.defineProperty(event, 'newState', {value: 'closed'});
+ this.dispatchEvent(event);
+ });
+ const originalMatches = HTMLElement.prototype.matches;
+ HTMLElement.prototype.matches = function (selector: string) {
+ if (selector === ':popover-open') {
+ return this.hasAttribute('popover-open');
+ }
+ return originalMatches.call(this, selector);
+ };
+});
+
+const defaultItems = [
+ {label: 'Edit', onClick: vi.fn()},
+ {label: 'Delete', onClick: vi.fn()},
+];
+
+describe('XDSMoreMenu', () => {
+ it('renders trigger button with default aria-label', () => {
+ render(<XDSMoreMenu items={defaultItems} />);
+ expect(
+ screen.getByRole('button', {name: 'More options'}),
+ ).toBeInTheDocument();
+ });
+
+ it('renders menu with role="menu"', () => {
+ render(<XDSMoreMenu items={defaultItems} />);
+ expect(screen.getByRole('menu', {hidden: true})).toBeInTheDocument();
+ });
+
+ it('has aria-haspopup and aria-expanded attributes', () => {
+ render(<XDSMoreMenu items={defaultItems} />);
+ const button = screen.getByRole('button', {name: 'More options'});
+ expect(button).toHaveAttribute('aria-haspopup', 'menu');
+ expect(button).toHaveAttribute('aria-expanded', 'false');
+ });
+
+ it('renders menu items', () => {
+ render(<XDSMoreMenu items={defaultItems} />);
+
+ expect(
+ screen.getByRole('menuitem', {name: 'Edit', hidden: true}),
+ ).toBeInTheDocument();
+ expect(
+ screen.getByRole('menuitem', {name: 'Delete', hidden: true}),
+ ).toBeInTheDocument();
+ });
+
+ it('opens menu when button is clicked', async () => {
+ const user = userEvent.setup();
+ render(<XDSMoreMenu items={defaultItems} />);
+
+ await user.click(screen.getByRole('button', {name: 'More options'}));
+ expect(HTMLElement.prototype.showPopover).toHaveBeenCalled();
+ });
+
+ it('calls onClick when item is clicked', async () => {
+ const handleEdit = vi.fn();
+ const items = [
+ {label: 'Edit', onClick: handleEdit},
+ {label: 'Delete', onClick: vi.fn()},
+ ];
+ const user = userEvent.setup();
+ render(<XDSMoreMenu items={items} />);
+
+ // Open the menu first
+ await user.click(screen.getByRole('button', {name: 'More options'}));
+ // Click the item
+ await user.click(
+ screen.getByRole('menuitem', {name: 'Edit', hidden: true}),
+ );
+
+ expect(handleEdit).toHaveBeenCalledOnce();
+ });
+
+ it('supports disabled state', () => {
+ render(<XDSMoreMenu items={defaultItems} isDisabled />);
+ const button = screen.getByRole('button', {name: 'More options'});
+ expect(button).toBeDisabled();
+ });
+
+ it('supports custom label', () => {
+ render(<XDSMoreMenu items={defaultItems} label="Row actions" />);
+ expect(
+ screen.getByRole('button', {name: 'Row actions'}),
+ ).toBeInTheDocument();
+ });
+
+ it('supports custom icon', () => {
+ const CustomIcon = () => <span data-testid="custom-icon">★</span>;
+ render(<XDSMoreMenu items={defaultItems} icon={<CustomIcon />} />);
+ expect(screen.getByTestId('custom-icon')).toBeInTheDocument();
+ });
+
+ it('supports data-testid', () => {
+ render(<XDSMoreMenu items={defaultItems} data-testid="my-menu" />);
+ expect(screen.getByTestId('my-menu')).toBeInTheDocument();
+ });
+
+ it('opens menu when clicked', async () => {
+ const user = userEvent.setup();
+ render(<XDSMoreMenu items={defaultItems} />);
+
+ await user.click(screen.getByRole('button', {name: 'More options'}));
+ expect(HTMLElement.prototype.showPopover).toHaveBeenCalled();
+ });
+
+ it('renders sections with group role', () => {
+ const items = [
+ {
+ type: 'section' as const,
+ title: 'Actions',
+ items: [{label: 'Edit', onClick: vi.fn()}],
+ },
+ ];
+ render(<XDSMoreMenu items={items} />);
+
+ expect(
+ screen.getByRole('group', {name: 'Actions', hidden: true}),
+ ).toBeInTheDocument();
+ });
+
+ it('does not call onClick for disabled items', async () => {
+ const handleEdit = vi.fn();
+ const items = [{label: 'Edit', onClick: handleEdit, isDisabled: true}];
+ const user = userEvent.setup();
+ render(<XDSMoreMenu items={items} />);
+
+ await user.click(screen.getByRole('button', {name: 'More options'}));
+ await user.click(
+ screen.getByRole('menuitem', {name: 'Edit', hidden: true}),
+ );
+
+ expect(handleEdit).not.toHaveBeenCalled();
+ });
+
+ it('supports forwardRef', () => {
+ const ref = vi.fn();
+ render(<XDSMoreMenu items={defaultItems} ref={ref} />);
+ expect(ref).toHaveBeenCalledWith(expect.any(HTMLElement));
+ });
+
+ it('renders dividers between items', () => {
+ const items = [
+ {label: 'Edit', onClick: vi.fn()},
+ {type: 'divider' as const},
+ {label: 'Delete', onClick: vi.fn()},
+ ];
+ render(<XDSMoreMenu items={items} />);
+
+ const separators = screen.getAllByRole('separator', {hidden: true});
+ expect(separators.length).toBeGreaterThanOrEqual(1);
+ });
+
+ it('defaults to ghost variant', () => {
+ render(<XDSMoreMenu items={defaultItems} />);
+ const button = screen.getByRole('button', {name: 'More options'});
+ // Ghost variant should render a button element
+ expect(button).toBeInTheDocument();
+ expect(button.tagName).toBe('BUTTON');
+ });
+});
diff --git a/packages/core/src/MoreMenu/XDSMoreMenu.tsx b/packages/core/src/MoreMenu/XDSMoreMenu.tsx
new file mode 100644
index 0000000000..cff26cb94d
--- /dev/null
+++ b/packages/core/src/MoreMenu/XDSMoreMenu.tsx
@@ -0,0 +1,493 @@
+/**
+ * @file XDSMoreMenu.tsx
+ * @input Uses React, StyleX, useXDSLayer, XDSButton, useXDSIcon, XDSDropdownMenuItem, XDSDivider
+ * @output Exports XDSMoreMenu component and XDSMoreMenuProps type
+ * @position Core implementation; consumed by index.ts
+ *
+ * Overflow menu with a three-dot icon trigger. A convenience wrapper
+ * that composes XDSButton (icon-only) + useXDSLayer for the dropdown.
+ *
+ * SYNC: When modified, update these files to stay in sync:
+ * - /packages/core/src/MoreMenu/README.md
+ * - /packages/core/src/MoreMenu/XDSMoreMenu.test.tsx
+ * - /packages/core/src/MoreMenu/index.ts
+ * - /apps/storybook/stories/MoreMenu.stories.tsx
+ */
+
+import {
+ forwardRef,
+ useCallback,
+ useId,
+ useMemo,
+ useRef,
+ useState,
+ type ReactNode,
+} from 'react';
+import * as stylex from '@stylexjs/stylex';
+import {useXDSLayer} from '../Layer/useXDSLayer';
+import {XDSButton, type XDSButtonVariant, type XDSButtonSize} from '../Button';
+import {useXDSIcon} from '../Icon/IconRegistry';
+import {XDSDropdownMenuItem} from '../DropdownMenu/XDSDropdownMenuItem';
+import {XDSDivider} from '../Divider';
+import type {
+ XDSDropdownMenuOption,
+ XDSDropdownMenuItemData,
+ XDSDropdownMenuDivider,
+ XDSDropdownMenuSection,
+} from '../DropdownMenu';
+import {
+ colorVars,
+ spacingVars,
+ radiusVars,
+ transitionVars,
+ typographyVars,
+ textSizeVars,
+} from '../theme/tokens.stylex';
+
+// =============================================================================
+// Styles
+// =============================================================================
+
+const styles = stylex.create({
+ dropdown: {
+ boxSizing: 'border-box',
+ maxHeight: '300px',
+ overflowY: 'auto',
+ padding: spacingVars['--spacing-1'],
+ borderRadius: radiusVars['--radius-element'],
+ backgroundColor: colorVars['--color-surface'],
+ boxShadow: `0 4px 12px ${colorVars['--color-shadow-elevation']}`,
+ opacity: 1,
+ transition: `opacity ${transitionVars['--transition-fast']}`,
+ },
+ popover: {
+ minWidth: '160px',
+ },
+ popoverGap: {
+ marginBlockStart: spacingVars['--spacing-1'],
+ marginBlockEnd: spacingVars['--spacing-1'],
+ },
+ sectionDivider: {
+ marginBlock: spacingVars['--spacing-1'],
+ },
+ divider: {
+ marginBlock: spacingVars['--spacing-1'],
+ },
+ item: {
+ boxSizing: 'border-box',
+ display: 'flex',
+ alignItems: 'center',
+ gap: spacingVars['--spacing-2'],
+ width: '100%',
+ padding: spacingVars['--spacing-2'],
+ borderRadius: radiusVars['--radius-content'],
+ fontFamily: typographyVars['--font-body'],
+ fontSize: textSizeVars['--text-base'],
+ color: colorVars['--color-text-primary'],
+ backgroundColor: 'transparent',
+ border: 'none',
+ cursor: 'pointer',
+ textAlign: 'left',
+ outline: 'none',
+ },
+ itemHighlighted: {
+ backgroundColor: colorVars['--color-hover-overlay'],
+ },
+ itemDisabled: {
+ opacity: 0.5,
+ cursor: 'not-allowed',
+ },
+});
+
+// =============================================================================
+// Type guards and utilities
+// =============================================================================
+
+function isItemData(
+ option: XDSDropdownMenuOption,
+): option is XDSDropdownMenuItemData {
+ return !('type' in option);
+}
+
+function isDivider(
+ option: XDSDropdownMenuOption,
+): option is XDSDropdownMenuDivider {
+ return 'type' in option && option.type === 'divider';
+}
+
+function isSection(
+ option: XDSDropdownMenuOption,
+): option is XDSDropdownMenuSection {
+ return 'type' in option && option.type === 'section';
+}
+
+function getSelectableItems(
+ options: XDSDropdownMenuOption[],
+): XDSDropdownMenuItemData[] {
+ const items: XDSDropdownMenuItemData[] = [];
+ for (const option of options) {
+ if (isItemData(option)) {
+ items.push(option);
+ } else if (isSection(option)) {
+ for (const item of option.items) {
+ items.push(item);
+ }
+ }
+ }
+ return items;
+}
+
+// =============================================================================
+// Props
+// =============================================================================
+
+export interface XDSMoreMenuProps {
+ /**
+ * Menu items — data array of actions, dividers, and sections.
+ * Same type as XDSDropdownMenu's `items` prop.
+ *
+ * For advanced menu content that can't be expressed as data,
+ * compose XDSButton + useXDSLayer + XDSDropdownMenuItem directly.
+ */
+ items: XDSDropdownMenuOption[];
+
+ /**
+ * Accessible label for the trigger button.
+ * Always used as aria-label (the button is always icon-only).
+ * @default 'More options'
+ */
+ label?: string;
+
+ /**
+ * Visual style variant of the trigger button.
+ * Matches XDSButton variant values.
+ * @default 'ghost'
+ */
+ variant?: XDSButtonVariant;
+
+ /**
+ * Size of the trigger button.
+ * Matches XDSButton size values.
+ * @default 'md'
+ */
+ size?: XDSButtonSize;
+
+ /**
+ * Override the default three-dot icon.
+ * Accepts any ReactNode (same as XDSButton's `icon` prop).
+ * @default Three horizontal dots from the icon registry ('moreHorizontal')
+ */
+ icon?: ReactNode;
+
+ /**
+ * Whether the menu trigger is disabled.
+ * @default false
+ */
+ isDisabled?: boolean;
+
+ /**
+ * Custom render function for items.
+ * Passed through to render custom item content.
+ * Only called for selectable items (not dividers/sections).
+ */
+ children?: (item: XDSDropdownMenuItemData) => ReactNode;
+
+ /**
+ * Test ID for testing frameworks.
+ */
+ 'data-testid'?: string;
+}
+
+// =============================================================================
+// Default item renderer
+// =============================================================================
+
+function DefaultItem({item}: {item: XDSDropdownMenuItemData}) {
+ return <XDSDropdownMenuItem icon={item.icon} label={item.label} />;
+}
+
+// =============================================================================
+// XDSMoreMenu
+// =============================================================================
+
+/**
+ * Overflow menu with a three-dot icon trigger.
+ *
+ * A convenience wrapper that composes an icon-only XDSButton with a
+ * dropdown menu. Eliminates the boilerplate of wiring up state management,
+ * positioning, and accessibility attributes for the common "more actions"
+ * pattern.
+ *
+ * For full control over trigger rendering or menu content, compose
+ * XDSButton + useXDSLayer + XDSDropdownMenuItem directly.
+ *
+ * @example
+ * ```
+ * <XDSMoreMenu
+ * items={[
+ * { label: 'Edit', onClick: handleEdit },
+ * { label: 'Delete', onClick: handleDelete },
+ * ]}
+ * />
+ * ```
+ */
+export const XDSMoreMenu = forwardRef<HTMLButtonElement, XDSMoreMenuProps>(
+ (
+ {
+ items,
+ label = 'More options',
+ variant = 'ghost',
+ size = 'md',
+ icon,
+ isDisabled = false,
+ children,
+ 'data-testid': testId,
+ },
+ ref,
+ ) => {
+ const moreIcon = useXDSIcon('moreHorizontal');
+ const buttonRef = useRef<HTMLButtonElement | null>(null);
+ const menuId = useId();
+ const [highlightedIndex, setHighlightedIndex] = useState(-1);
+
+ const selectableItems = useMemo(() => getSelectableItems(items), [items]);
+
+ const layer = useXDSLayer({
+ mode: 'context',
+ lightDismiss: true,
+ onHide: () => {
+ setHighlightedIndex(-1);
+ buttonRef.current?.focus();
+ },
+ });
+
+ const handleButtonClick = useCallback(() => {
+ if (layer.isOpen) {
+ layer.hide();
+ } else {
+ layer.show();
+ }
+ }, [layer]);
+
+ const closeMenu = useCallback(() => {
+ layer.hide();
+ }, [layer]);
+
+ const getItemId = useCallback(
+ (index: number) => `${menuId}-item-${index}`,
+ [menuId],
+ );
+
+ const handleItemClick = useCallback(
+ (item: XDSDropdownMenuItemData) => {
+ if (item.isDisabled) return;
+ item.onClick?.();
+ closeMenu();
+ },
+ [closeMenu],
+ );
+
+ const handleItemMouseEnter = useCallback(
+ (item: XDSDropdownMenuItemData, index: number) => {
+ if (item.isDisabled) return;
+ setHighlightedIndex(index);
+ },
+ [],
+ );
+
+ const handleKeyDown = useCallback(
+ (e: React.KeyboardEvent) => {
+ if (!layer.isOpen) {
+ if (e.key === 'ArrowDown' || e.key === 'Enter' || e.key === ' ') {
+ e.preventDefault();
+ layer.show();
+ setHighlightedIndex(0);
+ }
+ return;
+ }
+
+ switch (e.key) {
+ case 'ArrowDown':
+ e.preventDefault();
+ setHighlightedIndex(prev => {
+ let next = prev + 1;
+ while (
+ next < selectableItems.length &&
+ selectableItems[next].isDisabled
+ ) {
+ next++;
+ }
+ return next < selectableItems.length ? next : prev;
+ });
+ break;
+ case 'ArrowUp':
+ e.preventDefault();
+ setHighlightedIndex(prev => {
+ let next = prev - 1;
+ while (next >= 0 && selectableItems[next].isDisabled) {
+ next--;
+ }
+ return next >= 0 ? next : prev;
+ });
+ break;
+ case 'Home':
+ e.preventDefault();
+ {
+ let index = 0;
+ while (
+ index < selectableItems.length &&
+ selectableItems[index].isDisabled
+ ) {
+ index++;
+ }
+ setHighlightedIndex(index < selectableItems.length ? index : -1);
+ }
+ break;
+ case 'End':
+ e.preventDefault();
+ {
+ let index = selectableItems.length - 1;
+ while (index >= 0 && selectableItems[index].isDisabled) {
+ index--;
+ }
+ setHighlightedIndex(index >= 0 ? index : -1);
+ }
+ break;
+ case 'Escape':
+ e.preventDefault();
+ closeMenu();
+ break;
+ case 'Enter':
+ case ' ':
+ e.preventDefault();
+ if (
+ highlightedIndex >= 0 &&
+ highlightedIndex < selectableItems.length
+ ) {
+ handleItemClick(selectableItems[highlightedIndex]);
+ }
+ break;
+ }
+ },
+ [layer, selectableItems, highlightedIndex, closeMenu, handleItemClick],
+ );
+
+ const renderItem = useCallback(
+ (item: XDSDropdownMenuItemData, flatIndex: number) => {
+ const isHighlighted = flatIndex === highlightedIndex;
+
+ return (
+ <div
+ key={`${item.label}-${flatIndex}`}
+ id={getItemId(flatIndex)}
+ role="menuitem"
+ tabIndex={-1}
+ aria-disabled={item.isDisabled}
+ onClick={() => handleItemClick(item)}
+ onMouseEnter={() => handleItemMouseEnter(item, flatIndex)}
+ {...stylex.props(
+ styles.item,
+ isHighlighted && styles.itemHighlighted,
+ item.isDisabled && styles.itemDisabled,
+ )}>
+ {children ? children(item) : <DefaultItem item={item} />}
+ </div>
+ );
+ },
+ [
+ children,
+ highlightedIndex,
+ getItemId,
+ handleItemClick,
+ handleItemMouseEnter,
+ ],
+ );
+
+ const renderOptions = useCallback(() => {
+ let flatIndex = 0;
+ const elements: ReactNode[] = [];
+
+ for (let i = 0; i < items.length; i++) {
+ const option = items[i];
+
+ if (isDivider(option)) {
+ elements.push(
+ <XDSDivider key={`divider-${i}`} xstyle={styles.divider} />,
+ );
+ } else if (isSection(option)) {
+ const sectionItems: ReactNode[] = [];
+ for (const item of option.items) {
+ sectionItems.push(renderItem(item, flatIndex));
+ flatIndex++;
+ }
+ if (option.title) {
+ elements.push(
+ <XDSDivider
+ key={`section-divider-${i}`}
+ label={option.title}
+ xstyle={styles.sectionDivider}
+ />,
+ );
+ }
+ elements.push(
+ <div key={`section-${i}`} role="group" aria-label={option.title}>
+ {sectionItems}
+ </div>,
+ );
+ } else if (isItemData(option)) {
+ elements.push(renderItem(option, flatIndex));
+ flatIndex++;
+ }
+ }
+
+ return elements;
+ }, [items, renderItem]);
+
+ return (
+ <>
+ <XDSButton
+ ref={el => {
+ buttonRef.current = el;
+ layer.ref(el);
+ if (typeof ref === 'function') {
+ ref(el);
+ } else if (ref) {
+ (
+ ref as React.MutableRefObject<HTMLButtonElement | null>
+ ).current = el;
+ }
+ }}
+ label={label}
+ icon={icon ?? moreIcon}
+ variant={variant}
+ size={size}
+ isDisabled={isDisabled}
+ tooltip={layer.isOpen ? undefined : label}
+ onClick={handleButtonClick}
+ onKeyDown={handleKeyDown}
+ aria-haspopup="menu"
+ aria-expanded={layer.isOpen}
+ aria-controls={menuId}
+ aria-activedescendant={
+ layer.isOpen && highlightedIndex >= 0
+ ? getItemId(highlightedIndex)
+ : undefined
+ }
+ data-testid={testId}
+ />
+ {layer.render(
+ <div id={menuId} role="menu" {...stylex.props(styles.dropdown)}>
+ {renderOptions()}
+ </div>,
+ {
+ placement: 'below',
+ alignment: 'end',
+ xstyle: [styles.popover, styles.popoverGap],
+ },
+ )}
+ </>
+ );
+ },
+);
+
+XDSMoreMenu.displayName = 'XDSMoreMenu';
diff --git a/packages/core/src/MoreMenu/index.ts b/packages/core/src/MoreMenu/index.ts
new file mode 100644
index 0000000000..ecbd4c282f
--- /dev/null
+++ b/packages/core/src/MoreMenu/index.ts
@@ -0,0 +1,7 @@
+/**
+ * @file index.ts
+ * @output Exports XDSMoreMenu and related types
+ * @position Public API entry point
+ */
+
+export {XDSMoreMenu, type XDSMoreMenuProps} from './XDSMoreMenu';
diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts
index 5512c98f83..c3b5592fa1 100644
--- a/packages/core/src/index.ts
+++ b/packages/core/src/index.ts
@@ -47,6 +47,7 @@ export * from './Typeahead';
export * from './Tokenizer';
export * from './Dialog';
export * from './DropdownMenu';
+export * from './MoreMenu';
export * from './TopNav';
export * from './SideNav';
export * from './MobileNav';
diff --git a/packages/themes/default/src/icons.tsx b/packages/themes/default/src/icons.tsx
index ca6e286100..20b77368d2 100644
--- a/packages/themes/default/src/icons.tsx
+++ b/packages/themes/default/src/icons.tsx
@@ -21,6 +21,7 @@ import {
ClockIcon,
InformationCircleIcon,
Bars3Icon,
+ EllipsisHorizontalIcon,
} from '@heroicons/react/24/outline';
import {
@@ -50,4 +51,5 @@ export const defaultIconRegistry: XDSIconRegistry = {
clock: <ClockIcon {...iconProps} />,
externalLink: <ArrowTopRightOnSquareIcon {...iconProps} />,
menu: <Bars3Icon {...iconProps} />,
+ moreHorizontal: <EllipsisHorizontalIcon {...iconProps} />,
};
diff --git a/packages/themes/neutral/src/icons.tsx b/packages/themes/neutral/src/icons.tsx
index eb7d65d1b9..1eeda0af8a 100644
--- a/packages/themes/neutral/src/icons.tsx
+++ b/packages/themes/neutral/src/icons.tsx
@@ -25,6 +25,7 @@ import {
Clock,
ExternalLink,
Menu,
+ MoreHorizontal,
} from 'lucide-react';
const iconProps = {
@@ -46,4 +47,5 @@ export const neutralIconRegistry: XDSIconRegistry = {
clock: <Clock {...iconProps} />,
externalLink: <ExternalLink {...iconProps} />,
menu: <Menu {...iconProps} />,
+ moreHorizontal: <MoreHorizontal {...iconProps} />,
};