aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/PasswordInput.svelte
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2024-11-26 20:54:49 -0800
committerAdam Soltys <[email protected]>2024-11-26 20:54:49 -0800
commit872aa0b3b0b9a847b8afcdee7f1ad53c524ce4f0 (patch)
tree4d505c5b7c3f137b56c84cfaca12ed486aa4972c /src/components/PasswordInput.svelte
parentf9300236a3c0227e0eec58326fa322e58613bc2d (diff)
downloadcoinos-ui-872aa0b3b0b9a847b8afcdee7f1ad53c524ce4f0.tar.gz
coinos-ui-872aa0b3b0b9a847b8afcdee7f1ad53c524ce4f0.zip
warnings
Diffstat (limited to 'src/components/PasswordInput.svelte')
-rw-r--r--src/components/PasswordInput.svelte20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/components/PasswordInput.svelte b/src/components/PasswordInput.svelte
new file mode 100644
index 00000000..5885304b
--- /dev/null
+++ b/src/components/PasswordInput.svelte
@@ -0,0 +1,20 @@
+<script>
+ let { value = $bindable() } = $props();
+ let toggle = (e) => (show = !show);
+ let show = $state(false);
+ let icon = $derived(show ? "ph:eye-bold" : "ph:eye-slash-bold");
+</script>
+
+<label
+ for="password"
+ class="input flex items-center justify-center gap-2 w-full"
+>
+ {#if show}
+ <input name="password" type="text" bind:value class="clean" />
+ {:else}
+ <input name="password" type="password" bind:value class="clean" />
+ {/if}
+ <button type="button" aria-label="Toggle" onclick={toggle} class="contents">
+ <iconify-icon {icon} width="32"></iconify-icon>
+ </button>
+</label>