useElementByPoint

A React Hook that returns the element at a given point.

Demo

Source
Supported:
false
isActive:
false
Selected Element:
<undefined />
Mouse Position:
(0, 0)

Usage

See API for more details.

Source

Click links below to view source on GitHub.

API

const { isSupported, element, ...controls } = useElementByPoint(options)

Options

export type UseElementByPointOptions<M extends boolean = false> = Position & { /** * Whether to return multiple elements * * @defaultValue false */ multiple?: M /** * Whether to execute immediately * * @defaultValue true */ immediate?: boolean /** * The interval to execute * * @defaultValue 'requestAnimationFrame' */ interval?: 'requestAnimationFrame' | number }

Returns

Retuerns contain Pausable instance that can be paused, resumed.

See Pausable for more details.

export type UseElementByPointReturns<E extends Element | null | Element[]> = Pausable & { /** * Whether the browser supports the API */ isSupported: boolean /** * The element at the specified position */ element: E }