Menu2Popup API
API reference docs for the React Menu2Popup component. Learn about the props, CSS, and other APIs of this exported module.
Demos
Import
import MenuPopup from '@mui/material/Unstable_Menu2Popup';Props of the native component are also available.
| Name | Type | Default | Description |
|---|---|---|---|
| align | 'center' | 'end' | 'start' | 'start' | How to align the popup relative to the specified side. |
| alignOffset | func | number | 0 | Additional offset along the alignment axis in pixels. |
| anchor | HTML element | object | func | - | An element to position the popup against. |
| children | node | - | The menu items. |
| classes | object | - | Override or extend the styles applied to the component. See CSS classes API below for more details. |
| className | string | - | CSS class applied to the menu surface. |
| collisionAvoidance | { align?: 'flip' | 'none' | 'shift', fallbackAxisSide?: 'end' | 'none' | 'start', side?: 'flip' | 'none' } | { align?: 'none' | 'shift', fallbackAxisSide?: 'end' | 'none' | 'start', side?: 'none' | 'shift' } | - | Determines how to handle collisions when positioning the popup. |
| collisionBoundary | 'clipping-ancestors' | HTML element | Array<HTML element> | { height: number, width: number, x: number, y: number } | 'clipping-ancestors' | An element or a rectangle that delimits the area that the popup is confined to. |
| collisionPadding | number | { bottom?: number, left?: number, right?: number, top?: number } | 5 | Additional space to maintain from the edge of the collision boundary. |
| container | HTML element | object | func | - | The container element to portal the popup into. |
| disableAnchorTracking | bool | false | Whether to disable the popup from tracking layout shifts of its positioning anchor. |
| elevation | number | 8 | The elevation of the menu surface. |
| finalFocus | func | { current?: HTML element } | bool | - | Determines the element to focus when the menu is closed. |
| keepMounted | bool | false | Whether to keep the portal mounted in the DOM while the popup is hidden. |
| positionMethod | 'absolute' | 'fixed' | 'absolute' | Determines which CSS |
| side | 'bottom' | 'inline-end' | 'inline-start' | 'left' | 'right' | 'top' | 'bottom' | Which side of the anchor element to align the popup against. |
| sideOffset | func | number | 0 | Distance between the anchor and the popup in pixels. |
| slotProps | { backdrop?: func | object, list?: func | object, portal?: func | object, positioner?: func | object, root?: func | object, transition?: func | object } | - | The props used for each slot inside. |
| slots | { backdrop?: elementType, list?: elementType, portal?: elementType, positioner?: elementType, root?: elementType, transition?: elementType } | - | The components used for each slot inside. |
| sticky | bool | false | Whether to maintain the popup in the viewport after the anchor element was scrolled out of view. |
| style | object | - | Inline styles applied to the menu surface. |
| sx | Array<func | object | bool> | func | object | - | The system prop that allows defining system overrides as well as additional CSS styles. Applied to the menu surface. See the `sx` page for more details. |
| transitionDuration | 'auto' | number | { appear?: number, enter?: number, exit?: number } | 'auto' | The transition duration in milliseconds, or separate enter and exit durations. Set to 'auto' for height-dependent Grow timing, or 0 to disable the transition. Ignored when slots.transition is null. |
ref is forwarded to the root element.Theme default props
You can use MuiMenu2Popup to change the default props of this component with the theme.
| Slot name | Class name | Default component | Description |
|---|---|---|---|
| portal | .MuiMenu2Popup-portal | 'div' | The component used for the portal element, which contains the menu and its backdrops. |
| positioner | .MuiMenu2Popup-positioner | 'div' | The component used to position the menu surface. |
| backdrop | .MuiMenu2Popup-backdrop | The component used for the optional backdrop beneath the menu. Providing this slot or slotProps.backdrop renders it. Set to null to omit it, including when configured in the theme. | |
| root | .MuiMenu2Popup-root | Paper | The component used for the menu surface. The popup renders as this element. |
| transition | Grow | The transition applied to the popup element. Set to null to use CSS animations instead. | |
| list | .MuiMenu2Popup-list | List | The component used for the presentational list wrapper. |
Source code
If you did not find the information in this page, consider having a look at the implementation of the component for more detail.