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

useVisible

Monitors an element and returns counts for how many times it has entered and exited the visible viewport area.

Importing

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

Usage

Call signature

1
const [ref, entered, exited] = useVisible<T extends Element>(threshold?)

Parameters

threshold?:number = 0.5

The visibility threshold ratio required to register entry/exit events.

Returns

ref:React.RefObject<T | null>

A React ref to attach to the target DOM element.

entered:number

Total number of times the element entered the viewport.

exited:number

Total number of times the element exited the viewport.