useIntersectionObserver
Advanced IntersectionObserver hook.
1.3 KB
•Updated on September 3, 2026
Installation
Bash
pnpm dlx shadcn@latest add @spaceui/hooks-dom-use-intersection-observerUsage
Code
import { useIntersectionObserver } from '@/hooks/use-intersection-observer'
const [ref, entry] = useIntersectionObserver({ threshold: 0.5 })API Reference
Parameters / Props
| Parameter | Type | Default | Description |
|---|---|---|---|
options | IntersectionObserverInit | {} | Native observer options. |
Return Value
| Return Type | Description |
|---|---|
[RefObject<T>, IntersectionObserverEntry | undefined] | Ref and entry. |