Skip to content

useMeasure ​

Category
Browser

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
target?Target-The element to measure

Contributors ​

Source • Demo