Skip to content

useElementByPoint

Category
Export Size
953 B
Last Changed
last month

Reactive element by point.

Demo

Usage

ts
import { useElementByPoint, useMouse } from '@vueuse/core'

const { x, y } = useMouse({ type: 'client' })
const { element } = useElementByPoint({ x, y })

Type Declarations

typescript
export interface UseElementByPointOptions<Multiple extends boolean = false>
  extends ConfigurableDocument {
  x: MaybeRefOrGetter<number>
  y: MaybeRefOrGetter<number>
  multiple?: MaybeRefOrGetter<Multiple>
  immediate?: boolean
  interval?: "requestAnimationFrame" | number
}
export interface UseElementByPointReturn<Multiple extends boolean = false>
  extends Pausable {
  isSupported: Ref<boolean>
  element: Ref<Multiple extends true ? HTMLElement[] : HTMLElement | null>
}
/**
 * Reactive element by point.
 *
 * @see https://vueuse.org/useElementByPoint
 * @param options - UseElementByPointOptions
 */
export declare function useElementByPoint<M extends boolean = false>(
  options: UseElementByPointOptions<M>,
): UseElementByPointReturn<M>

Source

SourceDemoDocs

Contributors

Anthony Fu
Jelf
wheat
vaakian X
BaboonKing

Changelog

v10.2.0 on 6/16/2023
31b66 - feat: new multiple and interval options (#3089)
v10.0.0-beta.4 on 4/13/2023
4d757 - feat(types)!: rename MaybeComputedRef to MaybeRefOrGetter
0a72b - feat(toValue): rename resolveUnref to toValue
v9.11.0 on 1/17/2023
c3639 - fix: make document configurable (#2614)
v8.9.1 on 7/8/2022
a9ccc - feat(all): use MaybeComputedRef (#1768)

Released under the MIT License.