svelte-outside Svelte Themes

Svelte Outside

A svelte use directive for clicking/tapping outside an element.

Svelte-outside

A svelte use directive for click/tap outside an element.

Installation

npm install svelte-outside

Usage

Click outside

<script lang="ts">
    import { clickOutside } from "svelte-outside"
</script>

<div use:clickOutside={(e) => console.log("Clicked outside!")}>
  Click outside me!
</div>

Tap outside

<script lang="ts">
    import { tapOutside } from "svelte-outside"
</script>

<div use:tapOutside={(e) => console.log("Tap outside!")}>
  Tap outside me!
</div>

Top categories

Loading Svelte Themes