Skip to content

Tags Input

Free

Type a word and press Enter or a comma, or paste a list, and each word becomes a tag you can remove. It can also suggest tags.

  • Base UI
  • React 19
  • Tailwind CSS 4

Added Nov 9, 2026 · MIT + Commons Clause

Playground

Loading the preview

Props

The value is a string[]. Enter, a comma, a paste, or leaving the field adds a tag. Add items for suggestions.

The sample also uses Field. One command adds them with this item:

topics-field.tsx

TagsInput

PropTypeDefaultDescription
valuereadonly string[]—The tags. Use with onValueChange for a controlled Tags Input.
defaultValuereadonly string[]—The tags of an uncontrolled Tags Input.
onValueChange—Called with the new tags after an add, a remove, or Clear, and the Base UI change details (the Combobox details of a pick, a chip remove, or Clear; reason "none" for a typed add).
inputValuestring—The typed text. Use with onInputValueChange for a controlled input.
defaultInputValuestring""The typed text of an uncontrolled input.
onInputValueChange—Called when the typed text changes.
itemsreadonly string[]—Suggestions. With items the input is a combobox and a list opens below the frame; without them it is a plain text field. Tags already added leave the list.
delimitersreadonly string[]DEFAULT_TAGS_INPUT_DELIMITERSCharacters that add the typed text, as Enter does (default: comma). Enter always adds.
addOnPastebooleantrueSplit a paste on the delimiters and on line breaks, and add each part (default: true).
addOnBlurbooleantrueAdd the typed text when focus leaves the field (Tab, a click outside; default: true).
trimbooleantrueRemove the spaces around each tag (default: true).
isDuplicateisSameTagWhen two texts are the same tag (default: the same text with case ignored).
maxnumber—The most tags. At the max the input stays, so Backspace still reaches the tags.
validate—A check of each new tag: return the message to show, or null to accept it.
labelsPartial<TagsInputLabels>—Every string the Tags Input says, to translate. Pass a stable object (module level or useMemo): a new object on each render rebuilds the context and re-renders every tag.
onRefuse—Called for each text that did not become a tag, with the reason and the message shown.
childrenReactNode—
From Base UICombobox.RootBase UI docs
namestring—Identifies the field when a form is submitted.
formstring—Identifies the form that owns the internal input. Useful when the combobox is rendered outside the form.
idstring—The id of the component.
  • Use it when people may add any text as a value, with or without suggestions.
  • Use validate, max, and isDuplicate to refuse a tag, and show why with TagsInputMessage.
  • Use name to send one form entry per tag.
  • When each value must come from a fixed list, use a Combobox.
  • For tags that people only read, remove, or pick, use a Tag Group.
EnterAdds the typed text as a tag, or picks the highlighted row. In an empty input, submits the form.
CommaAdds the typed text as a tag. Set other keys with delimiters.
TabLeaves the field and adds the typed text as a tag, while addOnBlur is on.
BackspaceIn an empty input, moves focus to the last tag.
Left ArrowAt the start of the text, moves focus to the last tag. Right to left uses Right Arrow.
Left ArroworRight ArrowMoves focus between the tags.
BackspaceorDeleteOn a tag, removes it. A held key removes one tag.
EscapeWith the list closed, clears the typed text.

With no items, the input is a plain text field. With items, it is a combobox with a list.

TagsInputTagList is a toolbar, so give it an aria-label, such as "Topics". The arrow keys move between tags.

Backspace or Delete removes the focused tag. The remove and clear buttons are for the pointer and stay out of the tab order.

New tag
fade · 150ms · ease-out (0, 0, 0.2, 1) · the tag fades in

Built with

Installs with Tags Input

Components
Combobox
  1. AddedTags Input, with Combobox.
Open the release