Skip to content


  • Deprecated
  • Not reviewed for accessibility

A DropdownMenu provides an anchor (button by default) that will open a floating menu of selectable items. The menu can be opened and navigated using keyboard or mouse. When an item is selected, the menu will close and the onChange callback will be called. If the default anchor button is used, the anchor contents will be updated with the selection.


Use new version of ActionMenu with composable API, design updates and accessibility fixes.


const fieldTypes = [
{key: 0, text: 'Text'},
{key: 1, text: 'Number'},
{key: 3, text: 'Date'},
{key: 4, text: 'Single select'},
{key: 5, text: 'Iteration'},
const Example = () => {
const [selectedType, setSelectedType] = React.useState()
return (
renderAnchor={({children, ...anchorProps}) => (
<ButtonInvisible {...anchorProps}>
{children} <GearIcon />
placeholder="Field type"


Instead of DropdownMenu, you can use the ActionMenu with ActionList selectionVariant=single, this will give menu items the correct semantics:

const fieldTypes = [
{id: 0, text: 'Text'},
{id: 1, text: 'Number'},
{id: 3, text: 'Date'},
{id: 4, text: 'Single select'},
{id: 5, text: 'Iteration'},
const Example = () => {
const [selectedType, setSelectedType] = React.useState()
<ActionMenu.Button aria-label="Select field type">{ || 'Field type'}</ActionMenu.Button>
<ActionList selectionVariant="single">
{ => (
selected={ ===}
onSelect={() => setSelectedType(type)}

Or continue using deprecated API:

import {DropdownMenu} from '@primer/react/deprecated'


Component props

itemsItemProps[]undefinedRequired. A list of item objects to display in the menu
selectedItemItemInputundefinedAn ItemProps item from the list of items which is currently selected. This item will receive a checkmark next to it in the menu.
onChange?(item?: ItemInput) => unknownundefinedA callback which receives the selected item or undefined when an item is activated in the menu. If the activated item is the same as the current selectedItem, undefined will be passed.
placeholderstringundefinedOptional. A placeholder value to display when there is no current selection.
renderAnchor(props: DropdownButtonProps) => JSX.ElementDropdownButtonOptional. If defined, provided component will be used to render the menu anchor. Will receive the selected Item text as children prop when an item is activated.
renderItem(props: ItemProps) => JSX.ElementActionList.ItemOptional. If defined, each item in items will be passed to this function, allowing for custom item rendering.
groupMetadataGroupProps[]undefinedOptional. If defined, DropdownMenu will group items into ActionList.Groups separated by ActionList.Divider according to their groupId property.
Edit this page on GitHub
3 contributorskhiga8mperrotticolebemis
Last edited by khiga8 on January 11, 2023