README
React Scroll Utils
@volvo-cars/react-scroll-utils
This package exposes useful utility hooks that can be used to help you with user scrolling concerns.
Installation
💡 This package includes Typescript definitions
useElementHasScrolled
Returns an array with both a ref
and hasScrolled
element.
Name | Description | Type | Default Value |
---|---|---|---|
disabled |
If true, hook does not refresh dimensions. Will report the current scroll status if set to false after user has already scrolled. |
boolean |
false |
offsetThreshold |
Use to delay returning true for hasScrolled until the user has scrolled by that amount |
number |
0 |
Examples
A demonstration implementation can be found in the vcc-ui Storybook.