npm.io
0.7.7 • Published 2h ago

@volvo-cars/react-layout-utils

Licence
UNLICENSED
Version
0.7.7
Deps
1
Size
22 kB
Vulns
0
Weekly
0

@volvo-cars/react-layout-utils

React hooks for measuring and responding to DOM element dimensions at runtime.

What's included

  • useElementDimensions — Returns a ref and a Dimensions object (width, height) representing the element's size at render time. Supports a disabled flag and a throttle interval to limit update frequency
  • useResizeObserver — Observes an element using ResizeObserver and returns live width and height values as the element's size changes. Accepts a ref, box model, optional onResize callback, and a round function
  • useLayoutEffect — An SSR-safe alias for React.useLayoutEffect that falls back to useEffect in non-browser environments

Installation

yarn add @volvo-cars/react-layout-utils