Quick Example
useClickOutside Usage
ตัวอย่าง import และการใช้งานแบบสั้นสำหรับหน้า `use-click-outside`
Code
<script lang="ts">
import { useClickOutside } from 'svelora';
let open = $state(true);
const container = useClickOutside(() => (open = false));
</script>
<div use:container>Click outside me</div>
useClickOutside
Svelte action that detects clicks outside an element. Use it with use:useClickOutside.
Basic
Click inside the blue box — nothing happens. Click outside — counter increments.
Click outside me
Outside clicks: 0 Dropdown
Inline Edit
Click the text to edit. Click outside to save.
Enable / Disable
Toggle the listener on and off with the enabled option.