Skip to content

useMeasure ​

browser
test coverage
Last changed: 24 days ago

Hook to measure the size and position of an element

typescript
import { useMeasure } from '@siberiacancode/reactuse';

Usage ​

typescript
const { x, y, width, height, top, left, bottom, right } = useMeasure(ref);
// or
const { ref, x, y, width, height, top, left, bottom, right } = useMeasure();

Demo ​

Api ​

Parameters

NameTypeDefaultNote
targetHookTarget-The element to measure

Source ​

Source • Demo

Contributors ​

Avatardebabin

Released under the MIT License.