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
|**children**| Func/Node || false | Children should be either a function or a node |
57
-
|**render**| ({inView, ref}) => Node || false | Render prop allowing you to control the view. |
58
-
|**root**| HTMLElement || false | The HTMLElement that is used as the viewport for checking visibility of the target. Defaults to the browser viewport if not specified or if null. |
59
-
|**rootId**| String || false | Unique identifier for the root element - This is used to identify the IntersectionObserver instance, so it can be reused. If you defined a root element, without adding an id, it will create a new instance for all components. |
60
-
|**rootMargin**| String | '0px' | false | Margin around the root. Can have values similar to the CSS margin property, e.g. "10px 20px 30px 40px" (top, right, bottom, left). |
61
-
|**tag**| String | 'div' | false | Element tag to use for the wrapping element when rendering using 'children'. Defaults to 'div' |
62
-
|**threshold**| Number | 0 | false | Number between 0 and 1 indicating the the percentage that should be visible before triggering. Can also be an array of numbers, to create multiple trigger points. |
63
-
|**triggerOnce**| Bool | false | false | Only trigger this method once |
64
-
|**onChange**| Func || false | Call this function whenever the in view state changes |
65
-
66
28
## Usage
67
29
68
30
### Child as function
@@ -121,7 +83,32 @@ const Component = () => (
121
83
exportdefaultComponent
122
84
```
123
85
124
-
### Polyfill for intersection-observer
86
+
## Props
87
+
88
+
The **`<Observer />`** accepts the following props:
89
+
90
+
| Name | Type | Default | Required | Description |
|**children**| Func/Node || false | Children should be either a function or a node |
93
+
|**render**| ({inView, ref}) => Node || false | Render prop allowing you to control the view. |
94
+
|**root**| HTMLElement || false | The HTMLElement that is used as the viewport for checking visibility of the target. Defaults to the browser viewport if not specified or if null. |
95
+
|**rootId**| String || false | Unique identifier for the root element - This is used to identify the IntersectionObserver instance, so it can be reused. If you defined a root element, without adding an id, it will create a new instance for all components. |
96
+
|**rootMargin**| String | '0px' | false | Margin around the root. Can have values similar to the CSS margin property, e.g. "10px 20px 30px 40px" (top, right, bottom, left). |
97
+
|**tag**| String | 'div' | false | Element tag to use for the wrapping element when rendering using 'children'. Defaults to 'div' |
98
+
|**threshold**| Number | 0 | false | Number between 0 and 1 indicating the the percentage that should be visible before triggering. Can also be an array of numbers, to create multiple trigger points. |
99
+
|**triggerOnce**| Bool | false | false | Only trigger this method once |
100
+
|**onChange**| Func || false | Call this function whenever the in view state changes |
0 commit comments