Home
Docs
InfinityFX
©Copyright2016-2026 InfinityFX. All rights reserved.
InfinityFX®
Lively
v5.0.0
Getting started
Components
Animate
LayoutGroup
TextAnimation
ViewAnimation
Hooks
useAudio
useHover
useLink
useReducedMotion
useScroll
useSpring
useTap
useViewport
useVisible
Links
v4 docs
llms.txt

useScroll

Tracks the scroll position of a scrollable container element or the document window and exposes a reactive AnimationLink containing normalized x and y scroll offsets from 0 to 1.

Importing

1
import { useScroll } from '@infinityfx/lively/hooks';

Usage

Scroll down inside this box...

Call signature

1
const link = useScroll<T extends HTMLElement>(target?)

Parameters

target?:React.RefObject<T | null>

Optional React ref targeting a scrollable element. Defaults to tracking the document viewport scroll if omitted.

Returns

link:AnimationLink<{ x: number, y: number }>

A reactive Link containing normalized x and y scroll offsets from 0 to 1.