useScrollReveal
Overview
Derive a reactive hidden flag from scroll direction for hide-on-scroll page chrome.
Binds a scroll listener to the resolved target (rebinding if scrollRoot changes), measures the element's original bottom edge as the threshold past which it counts as scrolled away, and exposes hidden according to the chosen reveal strategy. The listener and any pending idle timer are torn down automatically when the surrounding effect scope is disposed (component unmount, or an explicit effectScope().stop()), so callers do not manage cleanup. The threshold is only auto-measured when the target or element identity changes; call the returned remeasure after layout shifts that move the element in place.
Signature
useScrollReveal(rootRef, options)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| rootRef | Ref | yes | Ref to the element whose original on-screen position defines the hide threshold (typically the chrome's own root). |
| options | ScrollRevealOptions | no | Reveal strategy, scroll container, and idle timing. |
Returns
The reactive hidden flag plus the raw scroll signals (so a multi-bar host can reuse one tracker across bars) and a remeasure function.
Source
client/lib/use/useScrollReveal.js:93