Tag Input
Enter or a comma adds the draft as a tag, and Backspace in an empty field removes the last one. Pasting text separated by commas, semicolons, or new lines adds each part.
Installation
Copy the command below and run it in your terminal.
Usage
Bind tags on Root, and place List and Input inside it. Duplicates are
rejected unless you set allowDuplicates. Set name to submit each tag with a form.
Examples
Responding to changes
onAdd and onRemove report single-tag edits; onTagsChange reports the whole list.
Validation
Return false or an error message from validate to reject a tag. onReject receives the reason; pass it to error to show it under the field.
Anatomy
TagInput.Root - Owns tags and draft entry state.
TagInput.List - Groups the entered tags.
TagInput.Tag - Renders one tag with its remove control.
TagInput.Input - Accepts new tag text.
bunx @sivir-ui/svelte add tag-input