TagsInput
Free-form chip entry — Enter or comma commits the current token; Backspace on empty removes the last tag.
Each tag's remove control has an accessible name (Remove {tag}); Backspace on empty removes the trailing tag.
Three sizes are available: sm, md (default), and lg.
Max tags
Section titled “Max tags”Set maxTags to cap how many tags can be added.
Commit keys
Section titled “Commit keys”Override commitKeys to change which keys commit the current token. Defaults to Enter and ,.
Suggestions
Section titled “Suggestions”Pass suggestions to expose a <datalist> of pre-filled options to the input.
States
Section titled “States” PropTypeDefaultDescription
value
readonly string[]
—
Controlled list of tags.
defaultValue
readonly string[]
—
Uncontrolled initial list of tags.
onValueChange
((tags: string[]) => void)
—
Fires with the next array on every commit / remove.
commitKeys
readonly string[]
["Enter", ","]
Keys that commit the current draft token.
placeholder
string
"Add tag…"
Placeholder rendered when no tags are present.
size
"sm"|"md"|"lg"
"md"
Control size.
variant
"outline"|"filled"|"ghost"
"outline"
Visual treatment.
disabled
boolean
—
Disables interaction.
readOnly
boolean
—
Renders tags but blocks editing.
invalid
boolean
—
Renders the invalid state.
suggestions
readonly string[]
—
Optional suggestions rendered as a `<datalist>` for the inline input.
unique
boolean
true
Disallow duplicate tags (case-sensitive).
maxTags
number
—
Hard cap on tag count.
renderTag
((tag: string, index: number, remove: () => void) => ReactNode)
—
Custom renderer for each tag. Receives the tag string, its index, and a `remove` callback.
label
string
—
Accessible label for the inline input.
aria-label
string
—
id
string
—
name
string
—
className
string
—
style
CSSProperties
—
Accessibility
Section titled “Accessibility”- Each rendered tag has a remove button with the accessible name
Remove {tag}. - Backspace on an empty input removes the most recent tag.
- The inline input forwards
aria-invalidfrominvalidand uses thelabel/aria-labelyou supply. - Blurring with a draft value commits the tag automatically.
- Duplicate tags are blocked by default; set
unique={false}to allow them.
Recipes
Section titled “Recipes”- Normalize entries inside
onValueChange(e.g. lower-casing or trimming). - Use
maxTagsfor filter-style inputs to keep queries predictable. - Use
renderTagto render branded chips or include extra metadata per tag.