useElementHover
Reactive element's hover state.
Demo
Usage
<template>
<button ref="myHoverableElement">
{{ isHovered }}
</button>
</template>
<script setup>
import { useElementHover } from '@vueuse/core'
const myHoverableElement = ref()
const isHovered = useElementHover(myHoverableElement)
</script>
<template>
<button ref="myHoverableElement">
{{ isHovered }}
</button>
</template>
<script setup>
import { useElementHover } from '@vueuse/core'
const myHoverableElement = ref()
const isHovered = useElementHover(myHoverableElement)
</script>
Type Declarations
export declare function useElementHover(el: MaybeRef<EventTarget>): Ref<boolean>
export declare function useElementHover(el: MaybeRef<EventTarget>): Ref<boolean>
Source
Contributors
Anthony Fu
Joe Maylor