From 4dbef3fcd7a14437d55c555cf10d50de8e50d7d1 Mon Sep 17 00:00:00 2001
From: ivarlovlie <git@ivarlovlie.no>
Date: Fri, 9 Dec 2022 11:57:12 +0900
Subject: feat: Move everything out of $lib

---
 code/app/src/components/checkbox.svelte | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)
 create mode 100644 code/app/src/components/checkbox.svelte

(limited to 'code/app/src/components/checkbox.svelte')

diff --git a/code/app/src/components/checkbox.svelte b/code/app/src/components/checkbox.svelte
new file mode 100644
index 0000000..bf3c293
--- /dev/null
+++ b/code/app/src/components/checkbox.svelte
@@ -0,0 +1,29 @@
+<script lang="ts">
+    import pwKey from "$actions/pwKey";
+    import {random_string} from "$help";
+
+    export let label: string;
+    export let id: string | undefined = "input__" + random_string(4);
+    export let name: string | undefined = undefined;
+    export let disabled: boolean | null = null;
+    export let checked: boolean;
+    export let required: boolean | null = null;
+    export let _pwKey: string | undefined = undefined;
+</script>
+
+<div class="flex items-center">
+    <input
+            {name}
+            use:pwKey={_pwKey}
+            {disabled}
+            {id}
+            {required}
+            type="checkbox"
+            bind:checked
+            class="h-4 w-4 text-teal-600 focus:ring-teal-500 border-gray-300 rounded"
+    />
+    <label for={id} class="ml-2 block text-sm text-gray-900">
+        {@html required ? "<span class='text-red-500'>*</span>" : ""}
+        {label}
+    </label>
+</div>
-- 
cgit v1.3

