useScroll

A hook to detect if the page or a specific element has been scrolled.

Installation

Import the component from the passport-ui package.

components/example.tsx
1import { useScroll } from "passport-ui";

Usage

Basic example showing how to use the component.

components/example.tsx
1const hasScrolled = useScroll(10);
2
3if (hasScrolled) {
4 // Add a shadow to the header
5}

Additional resources

Documentation and examples are available in Storybook.