Skip to content
Menu

Menu API

The API documentation of the Menu React component. Learn more about the properties and the CSS customization points.

import Menu from '@material-ui/core/Menu';

Props

Name Type Default Description
anchorEl union: object |
 func
The DOM element used to set the position of the menu.
autoFocus bool If true (default), the menu list (possibly a particular item depending on the menu variant) will receive focus on open.
children node Menu contents, normally MenuItems.
classes object Override or extend the styles applied to the component. See CSS API below for more details.
disableAutoFocusItem bool false Same as autoFocus=false.
MenuListProps object {} Properties applied to the MenuList element.
onClose func Callback fired when the component requests to be closed.

Signature:
function(event: object, reason: string) => void
event: The event source of the callback
reason: Can be:"escapeKeyDown", "backdropClick", "tabKeyDown"
onEnter func Callback fired before the Menu enters.
onEntered func Callback fired when the Menu has entered.
onEntering func Callback fired when the Menu is entering.
onExit func Callback fired before the Menu exits.
onExited func Callback fired when the Menu has exited.
onExiting func Callback fired when the Menu is exiting.
open * bool If true, the menu is visible.
PopoverClasses object classes property applied to the Popover element.
transitionDuration union: number |
 { enter?: number, exit?: number } |
 enum: 'auto'

'auto' The length of the transition in ms, or 'auto'
variant enum: 'menu' |
 'selectedMenu'
'selectedMenu' The variant to use. Use menu to prevent selected items from impacting the initial focus and the vertical alignment relative to the anchor element.

The ref is forwarded to the root element.

Any other properties supplied will be provided to the root element (Popover).

CSS

You can override all the class names injected by Material-UI thanks to the classes property. This property accepts the following keys:

Name Description
paper Styles applied to the Paper component.
list Styles applied to the List component via MenuList.

Have a look at the overriding styles with classes section and the implementation of the component for more detail.

If using the overrides key of the theme, you need to use the following style sheet name: MuiMenu.

Inheritance

The properties of the Popover component are also available. You can take advantage of this behavior to target nested components.

Notes

The component can cause issues in StrictMode.

Demos