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
+52-9
Original file line number
Diff line number
Diff line change
@@ -39,26 +39,69 @@ The standalone version does **not** come bundled with [scroll-into-view-if-neede
39
39
40
40
`import ScrollIntoViewIfNeeded from 'react-scroll-into-view-if-needed/dist/umd/standalone.js'`
41
41
42
-
## Optional Props
43
-
The following props are supported by the component.
44
-
45
-
You can _also_ pass standard html attributes like `className`, `id`, etc...
46
-
47
42
#### active
48
43
> Type: `boolean`
49
44
> Default: `true`
50
45
51
46
The `active` prop allows controll of _when_ to scroll to the component. By default, it will attempt to scroll as soon as it is mounted, but you can set this prop to manually control when to trigger the scroll behavior from the parent component.
> Full list of options [here](https://www.npmjs.com/package/scroll-into-view-if-needed#api)
78
+
79
+
The `options` prop simply passes options to `scroll-into-view-if-needed`. See all the possible options in their [API documentation](https://www.npmjs.com/package/scroll-into-view-if-needed#api).
80
+
81
+
```js
82
+
<ScrollIntoViewIfNeeded options={{
83
+
scrollMode:'always',
84
+
}}>
85
+
<div>Hello</div>
86
+
</ScrollIntoViewIfNeeded>
87
+
```
88
+
53
89
#### elementType
54
90
> Type: `string`
55
91
> Default: `'div'`
56
92
57
93
Set the wrapper component type. For example, this could also be `'footer'`, `'button'`, etc... See the React [createElement](https://reactjs.org/docs/react-api.html#createelement) api.
58
94
59
-
#### options
60
-
> Type: `object`
61
-
> Default: `{ duration: 250, easing: 'easeOut' }`
95
+
```js
96
+
<ScrollIntoViewIfNeeded elementType="span">
97
+
<div>Hello</div>
98
+
</ScrollIntoViewIfNeeded>
99
+
```
62
100
63
-
The `options` prop simply passes options to `scroll-into-view-if-needed`. See all the possible options in their [API documentation](https://www.npmjs.com/package/scroll-into-view-if-needed#api).
101
+
#### className, id, etc
102
+
103
+
You can also pass normal element attributes like `className` to the component.
104
+
105
+
## Upgrading from v1
64
106
107
+
This project has been updated along with `scroll-into-view-if-needed` and accepts the same `options`. Check out the [migration guide](https://www.npmjs.com/package/scroll-into-view-if-needed#breaking-api-changes-from-v1) over there!
0 commit comments