import {ActionMenu} from '@primer/react'
ActionMenu ships with ActionMenu.Button which is an accessible trigger for the overlay. It's recommended to compose ActionList with ActionMenu.Overlay
You can choose to have a different anchor for the Menu depending on the application's context.
Use selectionVariant on ActionList to create a menu with single or multiple selection.
To create an anchor outside of the menu, you need to switch to controlled mode for the menu and pass it as anchorRef to ActionMenu. Make sure you add aria-expanded and aria-haspopup to the external anchor:
To create an anchor outside of the menu, you need to switch to controlled mode for the menu and pass it as anchorRef to ActionMenu:
| Name | Type | Default | Description |
|---|---|---|---|
| children Required | React.ReactElement[] | Recommended: | |
| open | boolean | false | If defined, will control the open/closed state of the overlay. Must be used in conjuction with |
| onOpenChange | (open: boolean) => void | If defined, will control the open/closed state of the overlay. Must be used in conjuction with | |
| anchorRef | React.RefObject<HTMLElement> | Useful for defining an external anchor |
| Name | Type | Default | Description |
|---|---|---|---|
| children Required | React.ReactElement | ||
Additional props are passed to the <Button> element. See Button docs for a list of props accepted by the <Button> element. | |||
| Name | Type | Default | Description |
|---|---|---|---|
| children Required | React.ReactElement | Accepts a single child element |
| Name | Type | Default | Description |
|---|---|---|---|
| children Required | React.ReactNode | ||
| align | start | center | end | start | |
Additional props are passed to the <Overlay> element. See Overlay docs for a list of props accepted by the <Overlay> element. | |||
Interface guidelines: Action List + Menu