use-headroom
Create headers that are hidden after user scrolls past given distance
Source
Docs
Package
Usage
The use-headroom hook creates headers that are hidden after the user scrolls past a given distance in pixels.
It returns { pinned, scrollProgress } where pinned is true when the element is at least partially
visible and scrollProgress is a number between 0 (fully hidden) and 1 (fully visible).
Header is pinned
Definition
scrollProgress
Use scrollProgress to create a scroll-linked reveal animation. The value transitions
from 1 (fully visible) to 0 (fully hidden) as the user scrolls down past fixedAt,
and back to 1 as the user scrolls up. Direction changes mid-scroll are handled correctly —
the progress continues from wherever it was when the direction changed.
Exported types
The UseHeadroomOptions type is exported from @mantine/hooks;