Tag Input
Free-form tags: Enter or a separator adds, Backspace removes the last, pasting a list adds them all. Duplicates, a max and a validate function keep bad tags in the input. One hidden input per tag.
Enter or comma to add, Backspace to remove. Paste “a, b, c” to add several.
Up to 3, must contain a dot.
<TagInput>
Free-form tags: type and press Enter or a separator; paste a list to add many; Backspace in an empty input removes the last tag. name submits one hidden input per tag.
defaultValuedefault[]string[]Tags at first render (uncontrolled).
maxnumberMost tags allowed; typing stops at the limit.
onValueChange(tags: string[]) => voidCalled with every tag after an add or remove.
separatorsdefault[","]string[]Keys that commit the typed text, besides Enter. Pasted text is split on these too.
validate(tag: string) => booleanReturn false to reject a tag (it stays in the input). Runs after trimming.
valuestring[]Controlled tags; pair with
onValueChange.
| Prop | Type | Default |
|---|---|---|
defaultValueTags at first render (uncontrolled). | string[] | [] |
maxMost tags allowed; typing stops at the limit. | number | — |
onValueChangeCalled with every tag after an add or remove. | (tags: string[]) => void | — |
separatorsKeys that commit the typed text, besides Enter. Pasted text is split on these too. | string[] | [","] |
validateReturn false to reject a tag (it stays in the input). Runs after trimming. | (tag: string) => boolean | — |
valueControlled tags; pair with | string[] | — |
Also accepts every <input> prop.
<Tag>
Removable chip. Springs in and out when rendered inside AnimatePresence (mode="popLayout").
children*ReactNodeTag text.
disabledbooleanHides the remove button.
onRemove() => voidShows a remove button; its accessible name is "Remove <children>".
| Prop | Type | Default |
|---|---|---|
children*Tag text. | ReactNode | — |
disabledHides the remove button. | boolean | — |
onRemoveShows a remove button; its accessible name is "Remove <children>". | () => void | — |
* required. Every component also takes className.