use Client Point
Positions the floating element at a given client point (x, y)
,
usually generated by a mouse event. By default, the client’s
mouse position is automatically tracked.
This is useful to position a floating element at a given point, while also allowing anchoring to follow the point upon scroll.
Usage
This Hook returns event handler props.
To use it, pass it the context
object returned from
useFloating()
, and then feed its result into the
useInteractions()
array. The returned prop getters are
then spread onto the elements for rendering.
The default behavior is to follow the mouse cursor clientX
and
clientY
coordinates.
Pointer events
If the floating element is not interactive, disable pointer events:
This will ensure that the floating element does not block point updates.
Props
enabled
default: true
Conditionally enable/disable the Hook.
axis
default: 'both'
Whether to restrict the client point to an axis and use the reference element (if it exists) as the other axis. This can be useful if the floating element is also interactive.
x
default: null
An explicitly defined x
client coordinate.
y
default: null
An explicitly defined y
client coordinate.