Getting Started
Learn how to install and use Runed in your projects.
Installation
Install Runed using your favorite package manager:
npm install runed
Usage
Import one of the utilities you need to either a .svelte
or .svelte.js|ts
file and start using
it:
<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();