IsHovered

Determine if an element is hovered.

Demo

Is hovered: false

Usage

	<script lang="ts">
  import { IsHovered } from "runed";
 
  let el = $state<HTMLElement>();
  const isHovered = new IsHovered(() => el);
</script>
 
<button bind:this={el}>
  {!isHovered.current ? "Hover me!" : "Unhover me!"}
</button>
 
<p>Is hovered: <b>{isHovered.current ? "true" : "false"}</b></p>	
MIT

© 2024 Svecosystem Team