forms
Tag Input
A text field that turns entries into removable tags, for emails, skills, topics and filters, with validation, limits and paste support. Copy-paste ready.
Installation
Usage
Good to know
- Enter or a comma adds what's typed. By default the text is also added when the field loses focus; turn that off with
addOnBlur={false}. - Pasting a list separated by commas or new lines adds every entry at once.
- Backspace in an empty field removes the last tag.
- Tags are trimmed, empty ones are ignored, and duplicates are rejected (case-insensitive) unless you set
allowDuplicates. - A tag that fails
validatestays in the field so the user can fix it. Every rejected tag callsonTagReject(tag, reason)with"duplicate","invalid"or"max". - Use it with Field: pass
idto match the label, andaria-invalidto show the error state. - For picking from a fixed list instead of free text, use Combobox with
multiple.
API Reference
TagInput
Other props, including className, go on the inner <input>.
Examples
Suggestions
Buttons under the field add common skills in one click and disappear once added.
Limit
At most five topics, normalized to lowercase with hyphens, with a counter and a message at the limit.
Filter
A small field with a leading icon that filters a list to posts having every tag.