Presence

The usePresence hook reactively responds to the presence of the user and their input devices.

KeyValueNotes
viewport.width0The width of the viewport in pixels.
viewport.height0The height of the viewport in pixels.
viewport.pointer{x: 0, y: 0}The coordinate of the pointer in pixels, relative to the viewport.
body.width0The width of the <body> in pixels.
body.height0The height of the <body> in pixels.
body.y0The 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>.
pressedfalseWhether the pointer is currently pressed.
pointerTypeunknownThe 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!