useMouse

React sensor hooks that re-render on mouse position changes.

hooks
{
  "docX": 0,
  "docY": 0,
  "posX": 0,
  "posY": 0,
  "elX": 0,
  "elY": 0,
  "elH": 0,
  "elW": 0
}


🐭

Variants

useMouseHovered

{
  "docX": 0,
  "docY": 0,
  "posX": 0,
  "posY": 0,
  "elX": 0,
  "elY": 0,
  "elH": 0,
  "elW": 0
}


🐭

About

useMouse simply tracks mouse position; useMouseHovered allows you to specify extra options:

  • bound — to bind mouse coordinates within the element
  • whenHovered — whether to attach mousemove event handler only when user hovers over the element

Installation

Run the following command:

npx ever-ui-clx@0.2.1 add demo-use-mouse
# └──> Hook coming soon.

Usage