Skip to main content

use_element_hover

Function use_element_hover 

Source
pub fn use_element_hover<El, M>(el: El) -> Signal<bool>
Expand description

Reactive element’s hover state.

§Demo

Link to Demo

§Usage

let el = NodeRef::<Button>::new();
let is_hovered = use_element_hover(el);

view! {
    <button node_ref=el>{ move || format!("{:?}", is_hovered.get()) }</button>
}

§Server-Side Rendering

Make sure you follow the instructions in Server-Side Rendering.

On the server this returns a Signal that always contains the value false.