Learn how to install and use Runed in your projects.
Install Runed using your favorite package manager:
npm install runed
Import one of the utilities you need to either a .svelte or .svelte.js|ts file and start using it:
.svelte
.svelte.js|ts
<script lang="ts"> import { activeElement } from "runed"; let inputElement = $state<HTMLInputElement | undefined>(); </script> <input bind:this={inputElement} /> {#if activeElement.current === inputElement} The input element is active! {/if}
or
import { activeElement } from "runed"; function logActiveElement() { $effect(() => { console.log("Active element is ", activeElement.current); }); } logActiveElement();