Menu
A list of actions that opens next to its trigger, with icons, destructive and disabled items, and dividers.
Stability: experimental
Props
| Prop | Type | Default | Means |
label | string | | The menu's accessible name. |
items | { label?: string; icon?: string; destructive?: boolean; disabled?: boolean; divider?: boolean; onSelect?: () => void }[] | | The items in order. An item with divider: true is a line between groups. |
open | boolean | bindable(false) | Whether the menu shows. The trigger piece toggles it; choosing an item, Escape, Tab or a press outside clears it. |
placement | "bottom-start" | "bottom-end" | "top-start" | "top-end" | bottom-start | Where the menu sits next to its trigger. It flips and shifts to stay in the window. |
Pieces
| Piece | Means |
trigger | The control that opens the menu, such as an IconButton with the more icon. |
States
| State | Looks like |
open | A surface panel, at least 200px wide, with a border, a large radius and shadow; items 44px tall. |
focused item | The raised background. |
destructive item | The label and icon in the danger colour. |
disabled item | 45% opacity; skipped by the keys. |
opening | Fades and grows in, in 120 ms; at once with reduced motion. |
Accessibility
| |
| role | menu of menuitem buttons, with separators |
| name | The label prop (aria-label); each item by its text. |
| focus | On open, focus moves to the first item (the last when opened with ArrowUp). On close, focus returns to the trigger. |
| keyboard | ArrowDown and ArrowUp move between items, wrapping; Home and End go to the first and last; typing letters goes to the next item that starts with them; Enter or Space chooses; Escape or Tab closes. ArrowDown or ArrowUp on the closed trigger opens it. |
| notes | The trigger carries aria-haspopup="menu", aria-expanded and aria-controls. |
Theme tokens
color.surface color.ink color.border color.raised color.muted color.danger shadow.lg radius.lg radius.sm space.1 space.2 space.3 text.body
Example
<Menu label="Post actions" items={actions}><piece name="trigger"><IconButton icon="more" label="More" /></piece></Menu>