Skip to content
On this page

useElementByPoint

Category
Export Size
1.05 kB
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 })
import { useElementByPoint, useMouse } from '@vueuse/core'

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

Type Declarations

typescript
export interface UseElementByPointOptions extends ConfigurableDocument {
  x: MaybeComputedRef<number>
  y: MaybeComputedRef<number>
}
/**
 * Reactive element by point.
 *
 * @see https://vueuse.org/useElementByPoint
 * @param options - UseElementByPointOptions
 */
export declare function useElementByPoint(options: UseElementByPointOptions): {
  isActive: Readonly<Ref<boolean>>
  pause: Fn
  resume: Fn
  element: Ref<HTMLElement | null>
}
export type UseElementByPointReturn = ReturnType<typeof useElementByPoint>
export interface UseElementByPointOptions extends ConfigurableDocument {
  x: MaybeComputedRef<number>
  y: MaybeComputedRef<number>
}
/**
 * Reactive element by point.
 *
 * @see https://vueuse.org/useElementByPoint
 * @param options - UseElementByPointOptions
 */
export declare function useElementByPoint(options: UseElementByPointOptions): {
  isActive: Readonly<Ref<boolean>>
  pause: Fn
  resume: Fn
  element: Ref<HTMLElement | null>
}
export type UseElementByPointReturn = ReturnType<typeof useElementByPoint>

Source

SourceDemoDocs

Contributors

Anthony Fu
wheat
vaakian X
BaboonKing
Jelf

Changelog

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)
v7.3.0 on 12/12/2021
3edf7 - feat: new function (#1022)

Released under the MIT License.