useElementSize

A function that returns the size of an element.

Demo

Usage

	<script lang="ts">
  import { useElementSize } from "runed";
 
  let el = $state() as HTMLElement;
  const size = useElementSize(() => el);
</script>
 
<div>
  <textarea bind:this={el} />
  <p>Width: {size.width} Height: {size.height}</p>
</div>	
MIT

© 2024 Svecosystem Team