ActionMenu
A row's "more actions" menu built from a list of actions: an icon trigger that opens a Menu with one item per action. An action with a status keeps the menu open and shows a spinner while pending, then closes it.
Use for
- a manage menu on a table row or list item
- a kebab menu of row actions such as revoke or remove
- a menu item that stays open with a spinner while its action runs
Practices
| Guidance | Practice |
|---|---|
| Do | Pass a label that names the row, such as "Manage jane@example.com". |
| Do | Set status on an action whose work runs inside the menu. Leave it unset for an action that opens a dialog, so the menu closes on click. |
| Do | Pass triggerRef from useListRemovalFocus when the action can remove the row. |
| Don’t | Give two actions the same label. It is the item key. |
API reference
ActionMenu
Renders nothing when actions is empty. While any action is pending, every item is disabled and the menu ignores close requests.
| Prop | Type | Description |
|---|---|---|
label | string | Accessible name for the icon trigger. |
actions | ActionMenuAction[] | One item per action: label, onClick, and optional color (neutral or negative), icon and status (idle or pending). |
triggerRef | Ref<HTMLButtonElement> | Ref to the trigger button, to restore focus to it. |
disabled | boolean | Disables the trigger and every item. |
focusableWhenDisabled | boolean | Keeps the trigger in the tab order while disabled. |
Examples
Revoke from a row
<ActionMenu
label={fill(m.manage, { name: invitation.email })}
triggerRef={registerTrigger(invitation.id)}
actions={[{ label: m.revoke, color: 'negative', onClick: () => onRevokeClick(invitation) }]}
/>Related
- Menu
- useListRemovalFocus
useConfirmController