<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.
styleKeys: popoverstyleKeys: listbox

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.

Menu
This component is implemented using the <div /> as the root element. You can utilize the native attributes supported by <div /> tag. The ref is directly assigned to the root element, allowing you to access and manipulate it as needed.
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: string | number, value?: unknown) => void)false
null
maxHeight
Overwrites the max-height of the MenuPopover to a custom value (px)
numberfalse
null
disabledKeys
The keys of the disabled items in the Menu.
Set<string | number>false
null

MenuTrigger
This component is implemented using the <div /> as the root element. You can utilize the native attributes supported by <div /> tag. The ref is directly assigned to the root element, allowing you to access and manipulate it as needed.
See core props for additional props that can be applied to this component.

MenuPopover
This component is implemented using the <div /> as the root element. You can utilize the native attributes supported by <div /> tag. The ref is directly assigned to the root element, allowing you to access and manipulate it as needed.
See core props for additional props that can be applied to this component.
proptyperequireddefault
offset
The offset distance from the trigger element.
numberfalse
null
children
The content to be displayed within the popover.
ReactNodefalse
null
fullBleed
Specifies whether the popover should take up the full available width.
booleanfalse
null
placement
Specifies where the popover should be placed in relation to the trigger element The placement of the popover.
Placementfalse
top
bottom start
isNonModal
Specifies whether the popover is used in a non-modal context.
booleanfalse
false
hideArrow
Whether to hide the popover arrow Specifies whether to hide the arrow of the popover.
booleanfalse
false
true
labelText
⚠️ Deprecated - This is deprecated without a replacement.
stringfalse
null
portalContainer
The container for the portal where the popover is rendered.
Elementfalse
null

MenuItem
This component is implemented using the <li /> as the root element. You can utilize the native attributes supported by <li /> tag.
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
ReactNodefalse
null
disabled
Whether or not the option is disabled.
boolean | nullfalse
null
textValue
The option's human-readable string. Required if using JSX inside of an option
string | nullfalse
null
withThumbnail
Whether or not the option has a thumbnail.
boolean | nullfalse
null

Related