Skip to main content

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:

component.svelte
		<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

some-module.svelte.ts
		import { activeElement } from "runed";
 
function logActiveElement() {
	$effect(() => {
		console.log("Active element is ", activeElement.current);
	});
}
 
logActiveElement();