<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-5HGSQD2L" height="0" width="0" style="display:none;visibility:hidden" title="GTM"></iframe>

Menu

A dropdown menu of buttons and/or links.
styleKey: listboxstyleKey: popover

Use Menu...

  • To show set of actions available to a user when there is a limited space constraint.

Don't use Menu...

  • To hide critical actions for a user to complete a task. Use Button instead.

  • Menu consists of a MenuTrigger that wraps another element (often a Button, but it can be anything).
  • When that trigger is clicked, it launches a MenuPopover.
  • MenuPopover holds a MenuList, which contains one or more MenuItem children.
  • Each MenuItem acts as a button by default, but you can have it act as a link instead (see below).
  • Menu shares code with Listbox, and behaves similarly: to detect a user interaction with the Menu, use an onChange handler on the Menu itself.

The preview has been updated.

Icons

A MenuItem may contain an icon, which can help users discern the difference between options faster.

The preview has been updated.

Sections

Use MenuSection to display a section title to wrap a group of MenuItems. Each MenuSection requires a title and a key prop.

The preview has been updated.

Use an href prop on a MenuItem to make it act as a link instead of a button.

The preview has been updated.

Disabled

Use disabled on Button to prevent it from being opened, or on MenuItem to indicate that individual options are not relevant or available within the user's current context.

The preview has been updated.

Content

  • Use clear, concise labels to describe the action being performed by the Menu.
  • Use sentence case.
  • Do not use punctuation.

Icons

Icons should be size 20p.

Number of actions

Use between 2-7 actions. On smaller mobile devices, 2-4 actions typically fits nicely on a single viewport.

Props

Menu
See core props for additional props that can be applied to this component.
proptyperequireddefault
onChange
Callback function that gets triggered when the value changes (for backward compatibility).
((key: stringnumber, value?: unknown) => void)
false
null
maxHeight
Overwrites the max-height of the MenuPopover to a custom value (px)
number
false
null
disabledKeys
The keys of the disabled items in the Menu.
Set<stringnumber>
false
null
MenuItem
See core props for additional props that can be applied to this component.
proptyperequireddefault
label
The contents to render inside the ListboxButton. Can include JSX
ReactNode
false
null
disabled
Whether or not the option is disabled.
booleannull
false
null
textValue
The option's human-readable string. Required if using JSX inside of an option
stringnull
false
null
withThumbnail
Whether or not the option has a thumbnail.
booleannull
false
null
MenuPopover
See core props for additional props that can be applied to this component.
proptyperequireddefaultdeprecation notes
offset
The offset distance from the trigger element.
number
false
null
children
The content to be displayed within the popover.
ReactNode
false
null
fullBleed
Specifies whether the popover should take up the full available width.
boolean
false
null
placement
Specifies where the popover should be placed in relation to the trigger element The placement of the popover.
Placement
false
top
bottom start
isNonModal
Specifies whether the popover is used in a non-modal context.
boolean
false
false
hideArrow
Whether to hide the popover arrow Specifies whether to hide the arrow of the popover.
boolean
false
false
true
⚠️ Deprecated
labelText
@deprecated This is deprecated without a replacement.
string
false
null
This is deprecated without a replacement.
portalContainer
The container for the portal where the popover is rendered.
Element
false
null

Related