Popover API
The API documentation of the Popover React component. Learn more about the properties and the CSS customization points.
import Popover from '@material-ui/core/Popover';
Props
Name | Type | Default | Description |
---|---|---|---|
action | func | This is callback property. It's called by the component on mount. This is useful when you want to trigger an action programmatically. It currently only supports updatePosition() action. Signature: function(actions: object) => void actions: This object contains all possible actions that can be triggered programmatically. |
|
anchorEl | union: object | func |
This is the DOM element, or a function that returns the DOM element, that may be used to set the position of the popover. | |
anchorOrigin | { horizontal: union: number | enum: 'left' | 'center' | 'right' , vertical: union: number | enum: 'top' | 'center' | 'bottom' } |
{ vertical: 'top', horizontal: 'left',} | 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]. |
anchorPosition | { left: number, top: number } | 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. | |
anchorReference | enum: 'anchorEl' | 'anchorPosition' | 'none' |
'anchorEl' | |
children | node | The content of the component. | |
classes | object | Override or extend the styles applied to the component. See CSS API below for more details. | |
container | union: object | func |
A node, 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. |
|
elevation | number | 8 | The elevation of the popover. |
getContentAnchorEl | func | This function is called in order to retrieve the content anchor element. It's the opposite of the anchorEl property. The content anchor element should be an element inside the popover. It's used to correctly scroll and set the position of the popover. The positioning strategy tries to make the content anchor element just above the anchor element. |
|
marginThreshold | number | 16 | Specifies how close to the edge of the window the popover can appear. |
ModalClasses | object | classes property applied to the Modal element. |
|
onClose | func | Callback fired when the component requests to be closed. Signature: function(event: object, reason: string) => void event: The event source of the callback. reason: Can be: "escapeKeyDown" , "backdropClick" |
|
onEnter | func | Callback fired before the component is entering. | |
onEntered | func | Callback fired when the component has entered. | |
onEntering | func | Callback fired when the component is entering. | |
onExit | func | Callback fired before the component is exiting. | |
onExited | func | Callback fired when the component has exited. | |
onExiting | func | Callback fired when the component is exiting. | |
openĀ * | bool | If true , the popover is visible. |
|
PaperProps | object | Properties applied to the Paper element. |
|
transformOrigin | { horizontal: union: number | enum: 'left' | 'center' | 'right' , vertical: union: number | enum: 'top' | 'center' | 'bottom' } |
{ vertical: 'top', horizontal: 'left',} | 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)]. |
TransitionComponent | componentPropType | Grow | The component used for the transition. |
transitionDuration | union: number | { enter?: number, exit?: number } | enum: 'auto' |
'auto' | Set to 'auto' to automatically calculate transition time based on height. |
TransitionProps | object | Properties applied to the Transition element. |
Any other properties supplied will be spread to the root element (Modal).
CSS
You can override all the class names injected by Material-UI thanks to the classes
property.
This property accepts the following keys:
Name | Description |
---|---|
paper | Styles applied to the Paper component. |
Have a look at overriding with classes section and the implementation of the component for more detail.
If using the overrides
key of the theme,
you need to use the following style sheet name: MuiPopover
.
Inheritance
The properties of the Modal component are also available. You can take advantage of this behavior to target nested components.