React Scroll Area
npm install react-scroll-area
A React component that enables you to programmatically scroll to child components within it.
Example Usage
;;; { const scrollarea = ReactDOM; ; ; } { return <ScrollArea style=width: 400 height: 400 ref='scrollarea'> <h2 ref="first_target" style=marginBottom: 500>First Target</h2> <h2 ref="second_target">Second Target</h2> </ScrollArea> ; }
Options
Passed as second argument to scrollTo
method.
Prop Name | Description | Default Value |
---|---|---|
offsetTop | desired vertical offset of scroll container from target at end of scroll | 0 |
offsetLeft | desired horizontal offset of scroll container from target at end of scroll | 0 |
duration | duration of scroll | 200 |
delay | delay before starting to scroll | 0 |
tick | period between each tick of scroll animation | 30 |
License
MIT