# DropdownMenu

> A button that opens a short list of actions: MenuItems on Popover's grey plate, with a thin line between groups. The arrow keys move through them, Esc closes it.

| | |
|---|---|
| Kind | component |
| Contract | `review` · [dropdown-menu.contract.yaml](https://github.com/Runceanu/rost/blob/master/contracts/dropdown-menu.contract.yaml) |
| Guidance | `proposed` |
| Source | [Figma 755:25](https://www.figma.com/design/1Zy0wiWKXQAvsfDBX3KR0d/UI-Kit-v01?node-id=755-25) · read 2026-11-17 · frozen 2026-11-17 |
| Implemented in | nowhere yet |

## Install

It lands in `src/rost/dropdown-menu/`, with what it needs and its contract:

```sh
npx github:Runceanu/rost add dropdown-menu
```

Then import `src/rost/fonts.css` and `src/rost/tokens.css` once, at the root of the app. More on this in [Install](https://rost.build/docs/install.md).

## Props

| Prop | Type | Values | Default |
|---|---|---|---|
| `trigger` | slot |  |  |
| `label` | string |  |  |
| `children` | slot |  |  |

## Anatomy

- `root`: The browser's popover (`popover="auto"`) with `role="menu"`: under its button, 8px away, as Popover is, and moved when there's no room. It's its own plate, tighter than Popover's: 4px inside, at least 180px wide.
- `separator`: A 1px line between groups, 4px clear above and below, in the edge's grey.

## When to use

- **A row's actions.** A kebab IconButton at the end of a table row, or a More button on a card, with three to seven actions behind it.

## When not to use

- **One or two actions.** Show them as Buttons. A menu hides them for no gain.
- **Picking a value.** That's a **Select**.

## Behaviour

Pressing the trigger opens it under the trigger with the focus on the first item. Up and Down move through the items, Home and End to the ends, Enter or Space does the action and closes it. Esc, Tab or a click outside closes it, and the focus goes back to the trigger. It doesn't wrap: Down on the last item stays there.

## Accessibility

- **Element**: `role="menu"` on the plate, `role="menuitem"` on each item, `role="separator"` between groups. The trigger has `aria-haspopup="menu"` and `aria-expanded`.
- **Name**: The trigger's words, or `label`.
- **Keyboard**: The arrow keys inside, one Tab stop: the menu isn't in the page's tab order.
- **Colour**: The edge is drawing; the items carry their own contrast.

## Tokens

Every token this component uses, across all its variants.

| Token | Resolves to |
|---|---|
| `dropdown-menu/background` | `#171717` |
| `dropdown-menu/edge` | `#3a3a3a` |
| `dropdown-menu/separator` | `#3a3a3a` |
| `shadow/floating` | `0px 16px 24px 0px rgba(0, 0, 0, 0.16)` |
| `spacing/gap/2xsmall` | `4px` |
| `spacing/gap/none` | `0px` |
| `spacing/gap/small` | `8px` |
| `spacing/outline/small` | `1px` |
| `spacing/radius/medium` | `12px` |

## No token, on purpose

| Part | Property | Value | Why |
|---|---|---|---|
| `root` | `outline-offset` | `calc(-1 * var(--spacing-outline-small))` | Composed from a token: the edge sits inside the plate. |

See it live, with every value of every variant: [rost.build/components/dropdown-menu/](https://rost.build/components/dropdown-menu/)
