focusAction

An action to easily put focus on elements using a boolean value.

Demo

Usage

<script>
  import { focusAction } from "svelte-legos";
  let isFocused = true;
</script>

<input use:focusAction={isFocused} />
<button
  on:click={() => (isFocused = !isFocused)}
>
  Toggle Focus
</button>