@@ -12,7 +12,7 @@ React wrapper around [Popper](https://popper.js.org).
1212** important note:** Popper is ** not** a tooltip library, it's a _ positioning
1313engine_ to be used to build features such as (but not restricted to) tooltips.
1414
15- # Install
15+ ## Install
1616
1717Via package managers:
1818
@@ -33,14 +33,14 @@ Via `script` tag (UMD library exposed as `ReactPopper`):
3333<script src =" https://unpkg.com/react-popper/dist/index.umd.js" ></script >
3434```
3535
36- # Usage
36+ ## Usage
3737
3838> Using ` [email protected] ` ? You can find its documentation3939> [ clicking here] ( https://github.com/souporserious/react-popper/tree/v0.x )
4040
4141` react-popper ` provides two different APIs to help consume it:
4242
43- ## React Hooks
43+ ### React Hooks
4444
4545The ` usePopper ` hook can be used to quickly initialize a Popper, it requires a
4646basic understanding of how the
@@ -72,7 +72,12 @@ const Example = () => {
7272};
7373```
7474
75- ## Render Props
75+ ### Render Props
76+
77+ This is a legacy API for compatbility with v1.x users moving to Popper v2. We recommend using the Hook in new code.
78+
79+ <details >
80+ <summary >View details</summary >
7681
7782The ` Manager ` , ` Reference ` and ` Popper ` render-props components offer an
7883alternative API to initialize a Popper instance, they require a basic
@@ -103,6 +108,8 @@ const Example = () => (
103108);
104109```
105110
111+ </details >
112+
106113## API documentation
107114
108115### Hooks
@@ -152,6 +159,11 @@ has been destroyed.
152159
153160### Render Props
154161
162+ This is a legacy API for compatbility with v1.x users moving to Popper v2. We recommend using the Hook in new code.
163+
164+ <details >
165+ <summary >View details</summary >
166+
155167The ` Manager ` component is a simple wrapper that needs to surround all the other
156168` react-popper ` components in order to make them communicate with each others.
157169
@@ -255,6 +267,8 @@ An object containing custom settings for the
255267You can use this property to override their settings or to inject your custom
256268ones.
257269
270+ </details>
271+
258272## Usage with ` ReactDOM .createPortal `
259273
260274Popper.js is smart enough to work even if the **popper** and **reference**
@@ -300,16 +314,7 @@ const Example = () => {
300314## Usage without a reference ` HTMLElement `
301315
302316Whenever you need to position a popper based on some arbitrary coordinates, you
303- can provide ` Popper ` with a ` referenceElement ` property that is going to be used
304- in place of the ` referenceProps .getRef ` React ref.
305-
306- The ` referenceElement ` property must be an object with an interface compatible
307- with an ` HTMLElement ` as described in the
308- [Popper.js virtualElement documentation](https://popper.js.org/docs/v2/virtual-elements/),
309- this implies that you may also provide a real HTMLElement if needed.
310-
311- If ` referenceElement ` is defined, it will take precedence over any
312- ` referenceProps .ref ` provided refs.
317+ can provide Popper with a [virtual element](https://popper.js.org/docs/v2/virtual-elements/).
313318
314319` ` ` jsx
315320import { usePopper } from ' react-popper' ;
@@ -330,8 +335,6 @@ const virtualReference = {
330335 },
331336};
332337
333- // This popper will be positioned relatively to the
334- // virtual reference element defined above
335338const Example = () => {
336339 const [popperElement , setPopperElement ] = React .useState (null );
337340 const { styles , attributes } = usePopper (virtualReference, popperElement);
0 commit comments