svelte-outside
v0.0.3
Published
A svelte use directive for click/tap outside an element.
Downloads
178
Readme
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>