diff --git a/src/lib/components/common/Checkbox.svelte b/src/lib/components/common/Checkbox.svelte
index 9c9bfc8bb..a8568249d 100644
--- a/src/lib/components/common/Checkbox.svelte
+++ b/src/lib/components/common/Checkbox.svelte
@@ -6,17 +6,15 @@
export let disabled = false;
export let status: "off" | "on" | "some" = "off";
+ export let label = "";
let checkbox: HTMLInputElement;
$: checked = status === "on" || status === "some";
- function handleChange() {
- if (checked) {
- dispatch("check", { status });
- } else {
- dispatch("uncheck", { status });
- }
+ function onChange(e) {
+ console.log(e);
+ status = e.target.checked ? "on" : "off";
}
@@ -26,7 +24,9 @@
bind:this={checkbox}
{disabled}
{checked}
- on:input={handleChange}
+ on:input
+ on:change
+ on:input={onChange}
/>
{#if status === "on"}
@@ -35,13 +35,16 @@
{/if}
+ {label}