@stihl-design-system/components
Version:
Welcome to the STIHL Design System react component library.
15 lines (14 loc) • 568 B
TypeScript
import { RefObject } from 'react';
type Size = {
width: number;
height: number;
};
/**
* Returns the current size of a referenced HTML element and updates on size changes.
* Uses ResizeObserver to listen for size changes.
* Can be used to track dynamic size changes of elements in a React component.
* @param ref - A React ref object pointing to the target HTML element.
* @returns { width: number; height: number } - The current size of the element.
*/
export declare const useElementSize: <T extends HTMLElement>(ref: RefObject<T>) => Size;
export {};