use-mouse
Get mouse position relative to viewport or given element
Import
Source
Docs
Package
Usage
Provide ref to track mouse position over any element:
Mouse coordinates
{ x: 0, y: 0 }
If you do not provide ref mouse position will be captured relative to document element:
Mouse coordinates
{ x: 0, y: 0 }
API
Hook returns object with ref and x, y mouse coordinates:
On the first render (as well as during SSR), both x
and y
values are equal to 0
.
Definition
Feedback
Your feedback is most valuable contribution to the project, please share how you use Mantine, what features are missing and what is done good
Leave feedback