From f158a8671e3b651590d0873b4f232c49c5aa7850 Mon Sep 17 00:00:00 2001 From: Robonau <30987265+Robonau@users.noreply.github> Date: Thu, 21 Nov 2024 12:20:21 +0000 Subject: [PATCH] check --- src/lib/components/switch.svelte | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/lib/components/switch.svelte b/src/lib/components/switch.svelte index 41edd2c..0a28f92 100644 --- a/src/lib/components/switch.svelte +++ b/src/lib/components/switch.svelte @@ -36,6 +36,7 @@ // Provide a semantic label. label?: string; children?: import('svelte').Snippet; + onchange?: (e: boolean) => void; onkeydown?: ( e: KeyboardEvent & { currentTarget: EventTarget & HTMLDivElement; @@ -55,6 +56,7 @@ labelClass = 'ml-3', label = '', class: clasNames = '', + onchange = () => {}, onkeydown = () => {}, children, ...rest @@ -136,6 +138,9 @@ bind:checked {name} {...rest} + onchange={(e) => { + onchange(checked ?? false); + }} disabled={rest.disabled as boolean | undefined | null} />