ScrollPosition
interfaceSource L8Type contract for ScrollPosition.
interface ScrollPositionMembers
| Name | Type |
|---|---|
x | number |
y | number |
Open-code aq-ui React hook for Use Scroll Position.
pnpm dlx aq-ui@alpha add use-scroll-positionImport the parts you need, then jump to an export for its contract.
"use client"
import { useScrollPosition } from "@/hooks/use-scroll-position"
const result = useScrollPosition()Type contract for ScrollPosition.
interface ScrollPosition| Name | Type |
|---|---|
x | number |
y | number |
Open-code aq-ui React hook for Use Scroll Position.
function useScrollPosition(target?: Target<Element | Window>, initialValue: ScrollPosition = { x: 0, y: 0 }): ScrollPositionScrollPosition| Name | Type | Default |
|---|---|---|
target? | Target<Element | Window> | — |
initialValue? | ScrollPosition | { x: 0, y: 0 } |
hook-target, use-isomorphic-layout-effect