Function leptos_use::use_element_bounding

source ·
pub fn use_element_bounding<El, T>(
    target: El,
) -> UseElementBoundingReturn<impl Fn() + Clone>
where El: Into<ElementMaybeSignal<T, Element>> + Clone, T: Into<Element> + Clone + 'static,
Expand description

Reactive bounding box of an HTML element

§Demo

Link to Demo

§Usage

let el = create_node_ref::<Div>();
let UseElementBoundingReturn {
    x, y, top,right,bottom,left, width, height, ..
} = use_element_bounding(el);

view! { <div node_ref=el></div> }

§Server-Side Rendering

On the server the returned signals always are 0.0 and update is a no-op.