ActionMenu

ActionMenu is composed of ActionList and Overlay patterns used for quick actions and selections.

Page navigation navigation

React
readyNot reviewed for a11y
Rails
readyNot reviewed for a11y

An ActionMenu comprises a set of ActionList items, where each item represents an action, command, submenu, or the current selection that can be either a single or multi-select. The ActionMenu can be invoked by clicking on a Button, IconButton, or right-clicking on the list items.

React examples

Default

With a loading item

With an inactive item

Menu items affected by a system error, such as an outage, may become inactive and display a message explaining why.

If an ActionMenu (e.g., adding a file to a repo) has no available items, the trigger Button should be inactive.

Inactive ActionMenu items follow the same patterns as inactive list items, with two exceptions:

  • The unavailability message is displayed directly in the item, not in a tooltip, since the menu is hidden until opened.
  • No alert icon is needed, as the error message provides sufficient context.

Single-select

For single-select menus that display the selection in a Button, a label must be persist either internally or externally.

Multi-select

With dividers

To enhance the readability of menus that contain numerous item descriptions, it is recommended to incorporate dividers. This can effectively prevent the menu from becoming overwhelming.

With submenus

A menu with multiple levels is a common UI component used in desktop and mobile applications. It allows users to access nested subitems without cluttering the screen.

Multi-level menu guidelines

As a context menu

Menus can be triggered through a Button, IconButton or right clicking list items.

Right click the list items below to see the context menu

More code examples

Since ActionMenu is a wrapper around ActionList, the menu items support almost all of the same features as ActionList items.

See the ActionMenu Storybook stories.

Props

ActionMenu

NameRequiredDescription
children
Required
React.ReactElement[]
Recommended: `ActionMenu.Button` or `ActionMenu.Anchor` with `ActionMenu.Overlay`
open
boolean
If defined, will control the open/closed state of the overlay. Must be used in conjuction with `onOpenChange`.
onOpenChange
(open: boolean) => void
If defined, will control the open/closed state of the overlay. Must be used in conjuction with `open`.
anchorRef
React.RefObject<HTMLElement>
Useful for defining an external anchor

ActionMenu.Button

NameRequiredDescription
children
Required
React.ReactElement

ActionMenu.Anchor

NameRequiredDescription
children
Required
React.ReactElement
Accepts a single child element
id
string

ActionMenu.Overlay

NameRequiredDescription
children
Required
React.ReactNode
align
start | center | end
side
| 'inside-top' | 'inside-bottom' | 'inside-left' | 'inside-right' | 'inside-center' | 'outside-top' | 'outside-bottom' | 'outside-left' | 'outside-right'
Controls which side of the anchor the menu will appear
data-test-id
unknown
ID to use for React testing utilities.