Action menu

Use the action menu component to display a list of actions or selections that expand through a trigger button.

import {ActionMenu} from '@primer/react-brand'

Examples

Default

Loading

Icon button trigger-only

Use ActionMenu.IconButton when a familiar icon clearly communicates that contextual actions are available. Always provide a concise, context-specific aria-label, which also supplies content for the visible tooltip.

Prefer ActionMenu.Button when the icon would be ambiguous without a visible label.

Loading

Single selection

In single selection mode it is important to apply an aria-label to the ActionMenu.Button child. This provides the user with important and durable context on the selection they need to make.

Loading

Split-button layout

In this mode, the ActionMenu can be shown as a split button with an action on the left and a dropdown button with additional actions on the right.

The primary action may use a visible label or a familiar icon. For an icon-only primary action, ensure that its aria-label names the action, while the required ActionMenu.Overlay label names the generated menu trigger.

Loading

Sizes

ActionMenu is currently available in small and medium sizes, with the latter being the default.

Loading

Component props

ActionMenu Required

nametypedefaultrequireddescription
disabledbooleanfalsefalseControls the ActionMenu active/inactive state
openbooleanfalsefalseDetermines whether the ActionMenu is open by default
onSelect(newValue: string) => voidfalseCallback that is called when an item is selected
selectionVariant'single', 'none''none'falseThe selection variant of the ActionMenu
menuAlignment'start', 'end'startfalseHorizontal alignment of the menu relative to the bottom of the button
size'small', 'medium'mediumfalseSize configuration of the ActionMenu
menuSide'bottom', 'bottom-end', 'bottom-start', 'left', 'left-end', 'left-start', 'right', 'right-end', 'right-start', 'top', 'top-end', 'top-start'undefinedfalseLocation of the menu overlay
mode'default'
'split-button'
defaultfalseAlternative behavior for the button and menu items

ActionMenu.Button Required

nametypedefaultrequireddescription
classNamestringSets a custom class on the element
childrenReactElement
idstringSets a custom id
variant'primary', 'secondary', 'subtle'falseSets the button styling variation
onClick(event: MouseEvent) => voidundefinedfalseHandles activation of the button
leadingVisualReactElementundefinedfalseRenders a leading visual before the button label

ActionMenu.IconButton

nametypedefaultrequireddescription
iconIcontrueIcon that represents the menu trigger
aria-labelstringtrueAction-oriented accessible label and visible tooltip text
asElementType'button'falseElement rendered for the primary action
hrefstringundefinedfalseLink destination when the primary action renders as an anchor
variant'primary', 'secondary', 'subtle', 'danger', 'invisible''secondary'falseSets the icon button styling variation
descriptionstringundefinedfalseSupplies supplementary tooltip text
tooltipDirectionTooltipDirection's'falsePreferred direction for the automatic tooltip
roundedbooleanfalsefalseUses a fully rounded shape
onClick(event: MouseEvent) => voidundefinedfalseHandles activation; toggles the menu only in default mode

ActionMenu.Overlay Required

nametypedefaultrequireddescription
aria-labelstringtrueRequired for describing the relationship between button and menu
classNamestringSets a custom class on the element
childrenReactElement
idstringSets a custom id

ActionMenu.Item Required

nametypedefaultrequireddescription
classNamestringSets a custom class on the element
childrenReactElement
disabledbooleanfalsefalseAllows control over an individual items active/inactive state
idstringSets a custom id
selectedbooleanIndicates the item is selected in single selection mode
valuestringThe underlying value passed to the selection handler