import { RefObject } from 'react'; interface ElementSize { width: number; height: number; } /** * Hook that tracks an element's dimensions and updates when the element is resized. * * Uses ResizeObserver to efficiently monitor size changes and provides real-time * width and height measurements. Automatically handles cleanup and provides * initial measurements immediately. * * @param elementRef - React ref object pointing to the target HTML element * * @returns An object containing: * - `width`: Current width of the element in pixels * - `height`: Current height of the element in pixels * * @example * ```tsx * function ResizableComponent() { * const elementRef = useRef(null); * const { width, height } = useElementSize(elementRef); * * return ( *
*
* Resizable content *
*

Size: {width} x {height}px

*
* ); * } * ``` * * @see https://thibault.sh/hooks/use-element-size */ declare function useElementSize(elementRef: RefObject | null): ElementSize; export { useElementSize };