Skip to content

Zero dependency Svelte's action to handle click outside event

License

Notifications You must be signed in to change notification settings

Th1nkK1D/svelte-use-click-outside

Repository files navigation

svelte-use-click-outside

Zero dependency Svelte's action to handle click outside event

NPM Downloads

📦 Installation

npm i svelte-use-click-outside

📑 Usage

<script>
  import { clickOutside } from 'svelte-use-click-outside';

  function clickOutsideHandler() {
    // handler logic
  }
</script>

<div use:clickOutside={clickOutsideHandler} />

Inspired by https://svelte.dev/repl/0ace7a508bd843b798ae599940a91783

About

Zero dependency Svelte's action to handle click outside event

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published