Skip to content

Commit 7fd0b30

Browse files
committed
Add popover z index property.
1 parent a815992 commit 7fd0b30

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/components/Popover/Popover.jsx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,16 @@ export const Popover = React.forwardRef((props, ref) => {
1616
placementStyle,
1717
popoverTargetId,
1818
portalId,
19+
zIndex,
1920
...restProps
2021
} = props;
2122

23+
const placementStyleObject = placementStyle ? cleanPlacementStyle(placementStyle) : {};
24+
const style = zIndex !== undefined ? {
25+
...placementStyleObject,
26+
zIndex,
27+
} : placementStyleObject;
28+
2229
const PopoverEl = (
2330
<>
2431
{/**
@@ -43,7 +50,7 @@ export const Popover = React.forwardRef((props, ref) => {
4350
getRootAlignmentClassName(placement, styles),
4451
)}
4552
ref={ref}
46-
style={placementStyle ? cleanPlacementStyle(placementStyle) : undefined}
53+
style={style}
4754
>
4855
{children}
4956
<span className={styles.arrow} />
@@ -63,6 +70,7 @@ Popover.defaultProps = {
6370
placementStyle: undefined,
6471
popoverTargetId: undefined,
6572
portalId: undefined,
73+
zIndex: undefined,
6674
};
6775

6876
Popover.propTypes = {
@@ -116,6 +124,10 @@ Popover.propTypes = {
116124
* If set, popover is rendered in the React Portal with that ID.
117125
*/
118126
portalId: PropTypes.string,
127+
/**
128+
* Z-Index of the popover.
129+
*/
130+
zIndex: PropTypes.number,
119131
};
120132

121133
export const PopoverWithGlobalProps = withGlobalProps(Popover, 'Popover');

0 commit comments

Comments
 (0)