Loading...
Please waitLoading...
Please waitpnpm dlx uselab@latest add use-hover
import { useHover } from "@/hooks/use-hover"
export function Component() {
const [hoverRef, hovering] = useHover()
return (
<div
ref={hoverRef}
style={{
width: 200,
height: 200,
backgroundColor: hovering ? "lightblue" : "white",
}}
>
{hovering ? "Hovering!" : "Hover over me"}
</div>
)
}| Index | Type | Description |
|---|---|---|
0 | ref | A ref object that can be attached to the element intended to be hovered. |
1 | boolean | A boolean value indicating whether the element is currently being hovered. |