Skip to content

Popover API

API reference docs for the React Popover component. Learn about the props, CSS, and other APIs of this exported module.

Demos

For examples and details on the usage of this React component, visit the component demo pages:

Import

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

Props

Props of the Modal component are also available.

openRequired

If true, the component is shown.

Type:

bool
action

A ref for imperative actions. It currently only supports updatePosition() action.

Type:

ref
anchorEl

An HTML element, PopoverVirtualElement, or a function that returns either. It's used to set the position of the popover.

Type:

HTML element | func
anchorOrigin

This is the point on the anchor where the popover's anchorEl will attach to. This is not used when the anchorReference is 'anchorPosition'.
Options: vertical: [top, center, bottom]; horizontal: [left, center, right].

Type:

{ horizontal: 'center' | 'left' | 'right' | number, vertical: 'bottom' | 'center' | 'top' | number }

Default:

{ vertical: 'top', horizontal: 'left', }
anchorPosition

This is the position that may be used to set the position of the popover. The coordinates are relative to the application's client area.

Type:

{ left: number, top: number }
anchorReference

This determines which anchor prop to refer to when setting the position of the popover.

Type:

'anchorEl' | 'anchorPosition' | 'none'

Default:

'anchorEl'
children

The content of the component.

Type:

node
classes

Override or extend the styles applied to the component.

Type:

object
container

An HTML element, component instance, or function that returns either. The container will passed to the Modal component.
By default, it uses the body of the anchorEl's top-level document object, so it's simply document.body most of the time.

Type:

HTML element | func
elevation

The elevation of the popover.

Type:

integer

Default:

8
marginThreshold

Specifies how close to the edge of the window the popover can appear.

Type:

number

Default:

16
onClose

Callback fired when the component requests to be closed. The reason parameter can optionally be used to control the response to onClose.

Type:

func
PaperProps

Props applied to the Paper element.
This prop is an alias for slotProps.paper and will be overriden by it if both are used.

Type:

{ component?: element type }

Default:

{}
slotProps

The extra props for the slot components. You can override the existing props or add new ones.

Type:

{ paper?: func | object, root?: func | object }

Default:

{}
slots

The components used for each slot inside.

Type:

{ paper?: elementType, root?: elementType }

Default:

{}
sx

The system prop that allows defining system overrides as well as additional CSS styles.

Type:

Array<func | object | bool> | func | object
transformOrigin

This is the point on the popover which will attach to the anchor's origin.
Options: vertical: [top, center, bottom, x(px)]; horizontal: [left, center, right, x(px)].

Type:

{ horizontal: 'center' | 'left' | 'right' | number, vertical: 'bottom' | 'center' | 'top' | number }

Default:

{ vertical: 'top', horizontal: 'left', }
TransitionComponent

The component used for the transition. Follow this guide to learn more about the requirements for this component.

Type:

elementType

Default:

Grow
transitionDuration

Set to 'auto' to automatically calculate transition time based on height.

Type:

'auto' | number | { appear?: number, enter?: number, exit?: number }

Default:

'auto'
TransitionProps

Props applied to the transition element. By default, the element is based on this Transition component.

Type:

object

Default:

{}

The ref is forwarded to the root element.

Inheritance

While not explicitly documented above, the props of the Modal component are also available in Popover. You can take advantage of this to target nested components.

CSS

The following class names are useful for styling with CSS (the state classes are marked).
To learn more, visit the component customization page.

.MuiPopover-rootroot

Styles applied to the root element.

.MuiPopover-paperpaper

Styles applied to the Paper component.

You can override the style of the component using one of these customization options: