useElementBounding

reactive bounding box of any element

Demo

Usage

const const textAreaRef: Kaioken.MutableRefObject<HTMLTextAreaElement | null>textAreaRef = useRef<HTMLTextAreaElement | null>(initialValue: HTMLTextAreaElement | null): Kaioken.MutableRefObject<HTMLTextAreaElement | null> (+2 overloads)useRef<HTMLTextAreaElement | null>(null)
const 
const bounding: {
    width: Signal<number>;
    height: Signal<number>;
    top: Signal<number>;
    ... 5 more ...;
    update: () => void;
}
bounding
=
function useElementBounding(ref: Kaioken.MutableRefObject<Element | null>, options?: UseElementBoundingOptions): {
    width: Signal<number>;
    height: Signal<number>;
    top: Signal<...>;
    right: Signal<...>;
    bottom: Signal<...>;
    left: Signal<...>;
    x: Signal<...>;
    y: Signal<...>;
    update: () => void;
}
useElementBounding
(const textAreaRef: Kaioken.MutableRefObject<HTMLTextAreaElement | null>textAreaRef)