Skip to main content

use_hover

Function use_hover 

Source
pub fn use_hover() -> UseHover
Expand description

Obtains the UseHover registered against the current hook context slot.

Behaves like HookContext::use_hook - the same handle is returned on every render at the same hook index, so the document listeners are attached once and the hover state survives re-renders.

Attach get_target() to the caller’s markup with the ref: attribute, then read get_hovered() inside a render closure to react to the pointer entering or leaving.

§Returns

  • UseHover - The handle, with get_target() returning the NodeRef and get_hovered() the reactive Signal<bool>.