Leptos-Use Guide

use_element_hover

Reactive element's hover state.

Demo

Usage

use leptos::prelude::*;
use leptos::html::Button;
use leptos_use::use_element_hover;

#[component]
fn Demo() -> impl IntoView {
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

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

Feature

This function is only available if the crate feature use_element_hover is enabled

Types

Source

SourceDemoDocs