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
{{ message }}
This repository was archived by the owner on Dec 5, 2024. It is now read-only.
feat: Allow to pass target directly to Popper component (#92)
The Popper target previously was assumed to be made available via
context from the Manager component. Instead it can now be passed in
directly via props. This change required making the popover manager
in the context optional.
Closes#17
Copy file name to clipboardExpand all lines: README.md
+46-2Lines changed: 46 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,7 +39,7 @@ const PopperExample = () => (
39
39
)
40
40
```
41
41
42
-
## Usage w/ child function
42
+
## Usage with child function
43
43
44
44
This is a useful way to interact with custom components. Just make sure you pass down the refs properly.
45
45
@@ -77,6 +77,49 @@ const PopperExample = () => (
77
77
)
78
78
```
79
79
80
+
## Usage without Manager
81
+
82
+
It's generally easiest to let the `Manager` and `Target` components handle passing the target DOM element to the `Popper` component. However, you can pass a target [Element](https://developer.mozilla.org/en-US/docs/Web/API/Element) or a [referenceObject](https://popper.js.org/popper-documentation.html#referenceObject) directly into `Popper` if you need to.
83
+
84
+
Handling DOM Elements from React can be complicated. The `Manager` and `Target` components handle these complexities for you, so their use is strongly recommended when using DOM Elements.
Passes respective options to a new [Popper instance](https://github.com/FezVrasta/popper.js/blob/master/docs/_includes/popper-documentation.md#new-popperreference-popper-options). As for `onCreate` and `onUpdate`, these callbacks were intentionally left out in favor of using the [component lifecycle methods](https://facebook.github.io/react/docs/react-component.html#the-component-lifecycle). If you have a good use case for these please feel free to file and issue and I will consider adding them in.
0 commit comments