# Dropdown menu

> A menu button: trigger plus an NxMenu panel with focus management.

- Group: Navigation
- Status: stable
- Aliases: menu-button
- HTML page: https://design.ipmnx.com/components/dropdown-menu/
- Spec: https://design.ipmnx.com/design/#nx-menu

## Preview

**More** The preview opens its menu. The code is the closed trigger, all NxDropdownMenu renders until it opens.

```html
<div class="nx-dropdown">
  <button type="button" class="nx-dropdown__trigger"
      aria-haspopup="menu" aria-expanded="false" aria-label="More">
    <svg width="16" height="16" viewBox="0 0 24 24" fill="none"
        stroke="currentColor" stroke-width="2"
        stroke-linecap="round" stroke-linejoin="round"
        aria-hidden="true" focusable="false">
      <circle cx="12" cy="12" r="1" />
      <circle cx="19" cy="12" r="1" />
      <circle cx="5" cy="12" r="1" />
    </svg>
    More
  </button>
</div>
```

```tsx
<NxDropdownMenu
  trigger={<><MoreHorizontal aria-hidden="true" />More</>}
  triggerLabel="More"
  items={[
    { label: "Segments", href: "/marketing/segments" },
    { label: "Ideas", href: "/marketing/ideas" },
  ]}
/>
```

## API

### React props (NxKit)

| Prop | Type | Default | Required | Description |
| --- | --- | --- | --- | --- |
| `trigger` | `ReactNode` |   | yes | Button content. |
| `triggerLabel` | `string` |   | yes | Accessible name. |
| `items` | `NxMenuItem[]` |   | yes | Menu items. |
| `align` | `"start" \| "end"` | `"end"` |   | Panel alignment. |

### Classes

| Class | Description |
| --- | --- |
| `.nx-dropdown__trigger` | Neutral menu button |

## Accessibility

- WAI-ARIA menu button: aria-haspopup/expanded, Escape and outside click close, focus returns to the trigger.

## Do / Don't

- Do: Use for secondary navigation and overflow actions.
- Don't hide the page's primary action in a dropdown.

## Related

- [Menu](https://design.ipmnx.com/components/menu.md)
- [Context switcher](https://design.ipmnx.com/components/context-switcher.md)

---

Source: registry.js (NX Design System)
