You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+23Lines changed: 23 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -88,13 +88,34 @@ You might still want to use selection events to control whether the Popover is s
88
88
>Hey there</Popover>
89
89
```
90
90
91
+
### Using Popover inside a scrollable element
92
+
93
+
Some applications have scrollable elements inside them other than `<body>`. By default Popover repositions itself when the viewport scrolls (`window` that is). If you're using the `Popover` inside a scrollable element you need to define the `scrollRef` prop like so:
For more info on how to use the `Popover` component, please see below :)
92
112
93
113
## `<Popover />` Props
94
114
95
115
| Property | Type | required? | Description |
96
116
| - | - | - | - |
97
117
|`selectionRef`|`React.ref`| optional | Set this to constrain selection events to a dom element and its children. You need this especially if you use more than one Popover component __(defaults to `document`)__|
118
+
|`scrollRef`|`React.ref`| optional | By default Popover repositions itself when there's a scroll event for document.body. Set this to reposition the Popover upon scrolling of a given element |
98
119
|`isOpen`|`Boolean`| optional | Is the Popover visible or not __(defaults to `true`)__|
99
120
|`onTextSelect`|`Function`| optional | Callback for when text is selected (typically used for setting state that opens the modal) |
100
121
|`onTextUnSelect`|`Function`| optional | Callback for when selection collapses (typically used for setting state that closes the modal) |
0 commit comments