Tag Input

Chip field for a string[] value with suggestions, paste batching, and max tags.

Also known as: chips input, token input, multi value input

Installation

Install with the CLI, or copy the component source into your project.

Add tag-input (npm)

npx --yes -p @default-file/ui df-ui add tag-input

Default

Controlled string array. Add a tag with Enter or comma. Backspace on an empty draft removes the last chip.

AccessibilityMotion

Suggestions

Suggestion rows filter against the draft and hide tags that are already added. Focus the field to open the list.

Accessibility

Paste batching

Paste values separated by commas, semicolons, or spaces to commit several tags at once.

Paste values separated by commas, semicolons, or spaces to add several tags at once.

Max tags

maxTags stops further commits once the limit is reached. Suggestions close at the limit.

AccessibilityMotionDocumentation
Maximum of 3 topics.

Invalid

Invalid chrome with a validation message under the field.

Choose at least one topic.

Disabled

Disabled chips, input, and suggestions.

AccessibilityMotion

Reject feedback

onReject reports duplicate and max failures. Duplicate also plays a short shake.

Design tokens
Try adding Design tokens again.

Properties

Chip field for a string[] value with optional suggestions, paste batching, max tags, and reject feedback.

TagInput

PropTypeDefaultNotes
valuestring[]-Controlled tags.
defaultValuestring[][]Uncontrolled initial tags.
onValueChange(value: string[]) => void-Called when the tag list changes.
suggestionsreadonly string[][]Suggestion list filtered against the draft and existing tags.
maxTagsnumber-Upper bound on committed tags.
invalidbooleanfalseInvalid styling and aria-invalid on the combobox.
validationReactNode-Message under the field.
disabledbooleanfalseDisables chips, input, and suggestions.
placeholderstring-Input placeholder when there are no tags. Defaults to the string catalogue.
idstring-Id on the text input.
aria-labelstring-Applied on the root wrapper, not the combobox input. Prefer a visible Label with htmlFor pointing at id so the combobox itself is named.
itemChromeListItemChromeProps-Default List Item chrome for suggestion rows.
onReject(tag: string, reason: "duplicate" | "max") => void-Called when a commit is rejected. Duplicate also plays a short shake.
classNamestring-Additional styles on the root.

Keyboard and accessibility

Combobox (role="combobox"): The draft input is a combobox with list autocomplete. Arrow keys move the active suggestion; Enter commits the active suggestion or the draft; Escape closes the list; Backspace on an empty draft removes the last chip. Chip remove (button): Each chip remove control uses a catalogue aria-label that includes the tag text. Accessible name (Label htmlFor): Wire a visible Label with htmlFor matching id. The aria-label prop names the root wrapper only, so Label plus id is the reliable way to name the combobox.