|
9 | 9 |
|
10 | 10 | React wrapper around [Popper.js](https://popper.js.org). |
11 | 11 |
|
12 | | -**important note:** popper.js is **not** a tooltip library, it's a *positioning engine* to be used to build features such as (but not restricted to) tooltips. |
| 12 | +**important note:** popper.js is **not** a tooltip library, it's a _positioning engine_ to be used to build features such as (but not restricted to) tooltips. |
13 | 13 |
|
14 | 14 | ## Install |
15 | 15 |
|
@@ -61,8 +61,8 @@ const Example = () => ( |
61 | 61 | familiar with it, please read more [on the official React documentation](https://reactjs.org/docs/render-props.html). |
62 | 62 |
|
63 | 63 | > Using React <=15 or Preact? The components created with them don't support to return |
64 | | -[fragments](https://reactjs.org/docs/fragments.html), this means that you will need to |
65 | | -wrap `<Reference />` and `<Popper />` into a single, common, `<div />` to make `react-popper` work. |
| 64 | +> [fragments](https://reactjs.org/docs/fragments.html), this means that you will need to |
| 65 | +> wrap `<Reference />` and `<Popper />` into a single, common, `<div />` to make `react-popper` work. |
66 | 66 |
|
67 | 67 | ### API documentation |
68 | 68 |
|
@@ -99,27 +99,21 @@ children: ({| |
99 | 99 | |}) => Node |
100 | 100 | ``` |
101 | 101 |
|
102 | | -A function (render prop) that takes as argument an object containing the properties |
103 | | -`ref`, `style`, `placement`, and`arrowProps`. |
| 102 | +A function (render prop) that takes as argument an object containing the following properties: |
104 | 103 |
|
105 | | -The first 3 properties are the `ref` property that is going to be used to retrieve the [React refs](https://reactjs.org/docs/refs-and-the-dom.html) of the **popper** element, the `style` property, |
106 | | -which contains the CSS styles (React CSS properties) computed by Popper.js and needed to style |
107 | | -the **popper** element so that it gets positioned in the desired way. |
108 | | -These styles should be applied to your React component using the `style` prop or with any CSS-in-JS |
109 | | -library of your choice. |
110 | | -
|
111 | | -The `placement` property describes the placement of your popper after Popper.js has applied all the modifiers |
112 | | -that may have flipped or altered the originally provided `placement` property. You can use this to alter the |
113 | | -style of the popper and or of the arrow according to the definitive placement. For instance, you can use this |
114 | | -property to orient the arrow to the right direction. |
115 | | -
|
116 | | -`scheduleUpdate` is a function you can call to schedule a Popper.js position update. It will directly call the [Popper#scheduleUpdate](https://popper.js.org/popper-documentation.html#Popper.scheduleUpdate) method. |
117 | | -
|
118 | | -The `arrowProps` argument is an object, containing a `style` and `ref` properties that are identical to the |
119 | | -ones provided as first and second argument of `children`, but are relative to the **arrow** element rather than |
120 | | -the popper. Use them to, accordingly, retrieve the ref of the **arrow** element and style it. |
| 104 | +- **`ref`**: used to retrieve the [React refs](https://reactjs.org/docs/refs-and-the-dom.html) of the **popper** element. |
| 105 | +- **`style`**: contains the necessary CSS styles (React CSS properties) which are computed by Popper.js to correctly position the **popper** element. |
| 106 | +- **`placement`**: describes the placement of your popper after Popper.js has applied all the modifiers |
| 107 | + that may have flipped or altered the originally provided `placement` property. You can use this to alter the |
| 108 | + style of the popper and or of the arrow according to the definitive placement. For instance, you can use this |
| 109 | + property to orient the arrow to the right direction. |
| 110 | +- **`outOfBoundaries`**: a boolean signifying if the popper element is overflowing its boundaries. |
| 111 | +- **`scheduleUpdate`**: a function you can call to schedule a Popper.js position update. It will directly call the [Popper#scheduleUpdate](https://popper.js.org/popper-documentation.html#Popper.scheduleUpdate) method. |
| 112 | +- **`arrowProps`**: an object, containing `style` and `ref` properties that are identical to the |
| 113 | + ones provided as the first and second arguments of `children`, but relative to the **arrow** element. The `style` property contains `left` and `top` offset values, which are used to center the arrow within the popper. These values can be merged with further custom styling and positioning. See [the demo](https://github.com/FezVrasta/react-popper/blob/8994933c430e48ab62e71495be71e4f440b48a5a/demo/styles.js#L100) for an example. |
121 | 114 |
|
122 | 115 | ##### `innerRef` |
| 116 | +
|
123 | 117 | ```js |
124 | 118 | innerRef?: (?HTMLElement) => void |
125 | 119 | ``` |
|
0 commit comments