Skip to content

Commit db624ee

Browse files
committed
[Popover] Adding ModalClasses prop to popover component
1 parent 8029207 commit db624ee

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

packages/material-ui/src/Popover/Popover.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export interface PopoverProps
2828
getContentAnchorEl?: (element: HTMLElement) => HTMLElement;
2929
marginThreshold?: number;
3030
modal?: boolean;
31+
ModalClasses?: ModalClassKey;
3132
PaperProps?: Partial<PaperProps>;
3233
role?: string;
3334
transformOrigin?: PopoverOrigin;

packages/material-ui/src/Popover/Popover.js

+12-1
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,7 @@ class Popover extends React.Component {
278278
elevation,
279279
getContentAnchorEl,
280280
marginThreshold,
281+
ModalClasses,
281282
onEnter,
282283
onEntered,
283284
onEntering,
@@ -307,7 +308,13 @@ class Popover extends React.Component {
307308
containerProp || (anchorEl ? ownerDocument(getAnchorEl(anchorEl)).body : undefined);
308309

309310
return (
310-
<Modal container={container} open={open} BackdropProps={{ invisible: true }} {...other}>
311+
<Modal
312+
classes={ModalClasses}
313+
container={container}
314+
open={open}
315+
BackdropProps={{ invisible: true }}
316+
{...other}
317+
>
311318
<TransitionComponent
312319
appear
313320
in={open}
@@ -419,6 +426,10 @@ Popover.propTypes = {
419426
* Specifies how close to the edge of the window the popover can appear.
420427
*/
421428
marginThreshold: PropTypes.number,
429+
/**
430+
* `classes` property applied to the [`Modal`](/api/modal) element.
431+
*/
432+
ModalClasses: PropTypes.object,
422433
/**
423434
* Callback fired when the component requests to be closed.
424435
*

pages/api/popover.md

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ title: Popover API
2626
| <span class="prop-name">elevation</span> | <span class="prop-type">number | <span class="prop-default">8</span> | The elevation of the popover. |
2727
| <span class="prop-name">getContentAnchorEl</span> | <span class="prop-type">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. |
2828
| <span class="prop-name">marginThreshold</span> | <span class="prop-type">number | <span class="prop-default">16</span> | Specifies how close to the edge of the window the popover can appear. |
29+
| <span class="prop-name">ModalClasses</span> | <span class="prop-type">object |   | Override or extend the styles applied to the Modal component. See [CSS API](#css-api) below for more details. |
2930
| <span class="prop-name">onClose</span> | <span class="prop-type">func |   | Callback fired when the component requests to be closed.<br><br>**Signature:**<br>`function(event: object) => void`<br>*event:* The event source of the callback. |
3031
| <span class="prop-name">onEnter</span> | <span class="prop-type">func |   | Callback fired before the component is entering. |
3132
| <span class="prop-name">onEntered</span> | <span class="prop-type">func |   | Callback fired when the component has entered. |

0 commit comments

Comments
 (0)