From fbe43490d7f4390348feca7b577f704228752a53 Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Mon, 1 Dec 2025 02:43:44 -0800 Subject: [PATCH] ui: add TagInput component for nicknames MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Chip/tag style input for string arrays - Add/remove tags with Enter or comma - Backspace removes last tag when input empty - Supports label, error, maxTags, disabled 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- src/lib/components/ui/TagInput.svelte | 294 ++++++++++++++++++++++++++ 1 file changed, 294 insertions(+) create mode 100644 src/lib/components/ui/TagInput.svelte diff --git a/src/lib/components/ui/TagInput.svelte b/src/lib/components/ui/TagInput.svelte new file mode 100644 index 00000000..fce66b9b --- /dev/null +++ b/src/lib/components/ui/TagInput.svelte @@ -0,0 +1,294 @@ + + + + +{#if label || error} +
+ {#if label} + + {label} + + {/if} + +
e.key === 'Enter' && focusInput()} + role="button" + tabindex="-1" + > + {#each value as tag, index} + + {tag} + + + {/each} + + {#if canAddMore} + + {/if} +
+ + {#if error} + {error} + {/if} +
+{:else} +
e.key === 'Enter' && focusInput()} + role="button" + tabindex="-1" + > + {#each value as tag, index} + + {tag} + + + {/each} + + {#if canAddMore} + + {/if} +
+{/if} + +