Skip to content
+

Popper

The Popper component lets you create tooltips and popovers that display information about an element on the page.

Popper API

Import

import { Popper } from '@mui/base/Popper';
// or
import { Popper } from '@mui/base';
Learn about the difference by reading this guide on minimizing bundle size.

Props

Props of the native component are also available.

openRequired

If true, the component is shown.

Type:bool


anchorEl

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.

Type:HTML element
| object
| func


children

Popper render function or node.

Type:node
| func


container

An HTML element or function that returns one. The container will have the portal children appended to it.
You can also provide a callback, which is called in a React layout effect. This lets you set the container from a ref, and also makes server-side rendering possible.
By default, it uses the body of the top-level document object, so it's simply document.body most of the time.

Type:HTML element
| func


direction

Direction of the text.

Type:'ltr'
| 'rtl'

Default:'ltr'


disablePortal

The children will be under the DOM hierarchy of the parent component.

Type:bool

Default:false


keepMounted

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.

Type:bool

Default:false


modifiers

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.

Type: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> }>


placement

Popper placement.

Type:'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'

Default:'bottom'


popperOptions

Options provided to the Popper.js instance.

Type:{ 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' }

Default:{}


popperRef

A ref that points to the used popper instance.

Type:ref


slotProps

The props used for each slot inside the Popper.

Type:{ root?: func
| object }

Default:{}


slots

The components used for each slot inside the Popper. Either a string to use a HTML element or a component.

See Slots API below for more details.

Type:{ root?: elementType }

Default:{}


transition

Help supporting a react-transition-group/Transition component.

Type:bool

Default:false



The ref is forwarded to the root element.

CSS classes

These class names are useful for styling with CSS. They are applied to the component's slots when specific states are triggered.

.base-Popper-root

Class name applied to the root element.