Tags Input
A free-text tag entry field. Type a tag and press Enter (or comma) to commit it as a removable chip; Backspace on an empty input removes the last tag. Unlike Multi-Select, there is no predefined option list — any text becomes a tag. State is controlled through a @change callback that fires with the next array of strings.
designpuzzle
Installation
Copy the piece into your app — it compiles with your build and the code is yours:
puzzle add piece tags-input
No npm dependencies. Requires the pieces.css tokens merged into your app styles (see Introduction).
Usage
import TagsInput from '@/components/ui/TagsInput.pzl';
<TagsInput value={ tags } @change={ setTags } />Basic usage
value is an array of strings; each entry becomes a chip. Add a label and hint for the full field chrome.
typescriptgo
Max tags
redgreen
No duplicates
unique
Comma to add
Error state
Keyboard
Focus stays on the input; these keys drive the field:
- Enter / comma — commit the trimmed text as a new tag and clear the input
- Backspace — on an empty input, remove the last tag
- Paste — text with delimiters splits into several tags at once
- Chip × — click a chip's remove button to drop that tag
designpuzzle