UseActiveElement
A function that returns the currently active element.
Demo
Currently active element: No active element found
Usage
<script lang="ts">
import { useActiveElement } from "runed";
const activeElement = useActiveElement();
const text = $derived(
`Currently active element: ${
activeElement.value !== nulla
? activeElement.value.localName
: "No active element found"
}`a
);
</script>
<div class="rounded-md bg-card p-8">
<p>{text}</p>
</div>