Popper API
API documentation for the React Popper component. Learn about the available props and the CSS API.
Import
import Popper from '@mui/core/Popper';
// or
import { Popper } from '@mui/core';
Poppers rely on the 3rd party library Popper.js for positioning.
Props
Props of the native component are also available.
Name | Type | Default | Description |
---|---|---|---|
open* | bool | false | If true , the component is shown. |
anchorEl | HTML element | object | func | An HTML element, virtualElement, or a function that returns either. It's used to set the position of the popper. The return value will passed as the reference object of the Popper instance. | |
children | node | func | Popper render function or node. | |
container | HTML element | func | An HTML element or function that returns one. The container will have the portal children appended to it.By default, it uses the body of the top-level document object, so it's simply document.body most of the time. | |
disablePortal | bool | false | The children will be under the DOM hierarchy of the parent component. |
keepMounted | bool | false | Always keep the children in the DOM. This prop can be useful in SEO situation or when you want to maximize the responsiveness of the Popper. |
modifiers | Array<{ data?: object, effect?: func, enabled?: bool, fn?: func, name: any, options?: object, phase?: 'afterMain' | 'afterRead' | 'afterWrite' | 'beforeMain' | 'beforeRead' | 'beforeWrite' | 'main' | 'read' | 'write', requires?: Array<string>, requiresIfExists?: Array<string> }> | Popper.js is based on a "plugin-like" architecture, most of its features are fully encapsulated "modifiers". A modifier is a function that is called each time Popper.js needs to compute the position of the popper. For this reason, modifiers should be very performant to avoid bottlenecks. To learn how to create a modifier, read the modifiers documentation. | |
placement | 'auto-end' | 'auto-start' | 'auto' | 'bottom-end' | 'bottom-start' | 'bottom' | 'left-end' | 'left-start' | 'left' | 'right-end' | 'right-start' | 'right' | 'top-end' | 'top-start' | 'top' | 'bottom' | Popper placement. |
popperOptions | { modifiers?: array, onFirstUpdate?: func, placement?: 'auto-end' | 'auto-start' | 'auto' | 'bottom-end' | 'bottom-start' | 'bottom' | 'left-end' | 'left-start' | 'left' | 'right-end' | 'right-start' | 'right' | 'top-end' | 'top-start' | 'top', strategy?: 'absolute' | 'fixed' } | {} | Options provided to the Popper.js instance. |
popperRef | ref | A ref that points to the used popper instance. | |
transition | bool | false | Help supporting a react-transition-group/Transition component. |
The
ref
is forwarded to the root element.