We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b7264fe commit dceefc6Copy full SHA for dceefc6
src/lib/components/Accordion.svelte
@@ -1,6 +1,7 @@
1
<script>
2
import IconChevron from '$lib/icons/icon-chevron.svg?raw';
3
import { onMount } from 'svelte';
4
+ import { createEventDispatcher } from 'svelte';
5
6
export let id = (Math.random() * 10e15).toString(16);
7
export let type = "checkbox"; // or "radio"
@@ -9,6 +10,8 @@
9
10
export let foregroundColor = null;
11
export let backgroundColor = null;
12
13
+ const dispatch = createEventDispatcher();
14
+
15
let contentEl, inputEl;
16
onMount(() => {
17
contentEl.style.display = inputEl.checked ? 'block' : 'none';
@@ -27,6 +30,8 @@
27
30
contentEl.style.maxHeight = '0px';
28
31
});
29
32
}
33
+ // Dispatch click event so parent components can handle it (e.g., update URL hash)
34
+ dispatch('click');
35
36
37
function onTransitionEnd() {
0 commit comments