vasucp1207 / sveltronics

Svelte utility functions for your project
https://sveltronics.netlify.app/
MIT License
85 stars 5 forks source link
svelte sveltekit typescript
lib-icon

Sveltronics

Svelte utility functions for your project

📦Installation

npm i sveltronics

🐰Usage

<script>
  import { resizeable, elementSize } from "sveltronics";
  import { onMount } from "svelte";

  let myEle;
  let { height, width } = {};
  onMount(() => {
    ({ height, width } = elementSize(myEle));
  })

</script>

<div 
  bind:this={myEle}
  use:resizeable
>
  Resizeable
</div>

<div>Height: {$height}</div>
<div>Width: {$width}</div>