Toggle theme

React Scroll Utils🔗

@volvo-cars/react-scroll-utils

@volvo-cars/react-scroll-utils
@volvo-cars/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
disabledIf true, hook does not refresh dimensions. Will report the current scroll status if set to false after user has already scrolled.booleanfalse
offsetThresholdUse to delay returning true for hasScrolled until the user has scrolled by that amountnumber0

Examples🔗

A demonstration implementation can be found in the vcc-ui Storybook.

2022 © Volvo Car Corporation