Presence
The usePresence
hook reactively responds to the presence of the user and their input devices.
Key | Value | Notes |
---|---|---|
viewport.width | 0 | The width of the viewport in pixels. |
viewport.height | 0 | The height of the viewport in pixels. |
viewport.pointer | {x: 0, y: 0} | The coordinate of the pointer in pixels, relative to the viewport. |
body.width | 0 | The width of the <body> in pixels. |
body.height | 0 | The height of the <body> in pixels. |
body.y | 0 | The y coordinate of the <body> in pixels, relative to the viewport. |
body.pointer | {x: 0, y: 0} | The coordinate of the pointer in pixels, relative to the <body>. |
pressed | false | Whether the pointer is currently pressed. |
pointerType | unknown | The type of the pointer. |
Stores the presence state in a global store, so it can be accessed from anywhere in the app without duplicating work, leading to improved performance. Throttles event updates to 30-60 FPS
in coordination with CSS transitions for smooth, performant animations.
Join our newsletter to stay up to date on our progress!