MenuPreviewPopup API
API reference docs for the React MenuPreviewPopup component. Learn about the props, CSS, and other APIs of this exported module.
Demos
Import
import MenuPreviewPopup from '@mui/material/MenuPreviewPopup';| 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. |
| arrowPadding | number | 5 | Minimum distance to maintain between the arrow and the edges of the popup. |
| 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 Base UI popup element. |
| 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 | { list?: func | object, paper?: func | object, popup?: func | object, portal?: func | object, positioner?: func | object } | - | The props used for each slot inside. |
| slots | { list?: elementType, paper?: elementType, popup?: elementType, portal?: elementType, positioner?: 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 | - | Styles applied to the Base UI popup element. |
| sx | Array<func | object | bool> | func | object | - | The system prop that allows defining system overrides as well as additional CSS styles. See the `sx` page for more details. |
| Slot name | Class name | Default component | Description |
|---|---|---|---|
| portal | BaseMenu.Portal | The component used for the portal. | |
| positioner | BaseMenu.Positioner | The component used for the positioner. | |
| popup | 'div' | The component rendered by the Base UI popup. | |
| paper | .MuiMenuPreviewPopup-paper | Paper | The component used for the Material surface. |
| list | .MuiMenuPreviewPopup-list | List | The component used for the presentational list wrapper. |
These class names are useful for styling with CSS. They are applied to the component's slots when specific states are triggered.
| Class name | Rule name | Description |
|---|---|---|
| .MuiMenuPreviewPopup-root | root | Styles applied to the root element. |
You can override the style of the component using one of these customization options:
- With a global class name.
- With a rule name as part of the component's
styleOverridesproperty in a custom theme.
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.