Input
Tag Input
NewA field that turns words into removable tags on Enter or comma, with a nudge when a tag is already there.
npx motionsnack add tag-inputCustomize
<TagInput />Props
29 properties
| Property | Type | Default | Description |
|---|---|---|---|
| value | string[] | - | Controlled tags. Leave undefined to let the component manage them. |
| defaultValue | string[] | ['Branding', 'Web design', 'Motion'] | Tags on first render when uncontrolled. |
| onChange | (value: string[]) => void | - | Called with the new list whenever a tag is added or removed. |
| name | string | - | Name submitted with a form; each tag goes as its own value. |
| separators | string[] | [',', 'Enter'] | Keys and characters that finish a tag. |
| validate | (tag: string) => string | null | - | Checks a new tag: returns an error message, or null. |
| errorColor | string | undefined | Error colour for both themes. Undefined uses the per-theme pair. |
| invalidLabel | Partial<Record<Intl.LDMLPluralRule, string>> | { one: '{tags} is not valid.', other: '{n} tags are not valid: {tags}.' } | Error when several tags fail validate. |
| removeLabel | string | 'Remove {tag}' | Name of a tag's remove button. |
| addedLabel | string | '{tag} added' | Announced after a tag is added. |
| removedLabel | string | '{tag} removed' | Announced after a tag is removed. |
| locale | string | 'en-US' | Locale for comparing tags, plurals and lists. |
| tags | string[] | - | Deprecated: use value. |
| defaultTags | string[] | - | Deprecated: use defaultValue. |
| tagStyle | 'soft' | 'solid' | - | Deprecated: tags are always the soft static tag. |
| tagRadius | number | - | Deprecated: the tag radius is fixed at 6px. |
| id | string | generated | Id of the input. |
| className | string | '' | Extra classes on the wrapper. |
| label | string | 'Skills' | Label above the field. Empty hides it. |
| placeholder | string | 'Add a skill…' | Hint inside the field while there is room for more tags. |
| maxTags | number | 8 | Most tags the field takes. 0 means no limit. |
| maxLength | number | 24 | Longest tag in characters. |
| helperText | string | 'Press Enter or comma to add. Backspace removes the last one.' | Small text under the field. Empty hides it. |
| limitText | string | 'You can add up to {n} tags.' | Text shown when the limit is reached. {n} is the number. |
| error | string | '' | Error message. Any text switches the field to its error state. |
| required | boolean | false | Marks the field as required. |
| disabled | boolean | false | Disables the field. |
| height | number | 48 | Height of the field with one row of tags. It grows with more rows. |
| radius | number | 12 | Corner radius of the field. |
About Tag Input
Tag Input collects a short list such as skills, keywords or topics. Typing a word and pressing Enter or a comma turns it into a tag that pops into place; pasting a comma-separated list adds them all at once. Backspace in the empty field first marks the last tag and removes it on the second press, so nothing disappears by accident. Adding a tag that is already there nudges the existing one instead of doubling it. A limit on the number and length of tags, soft or solid tags and a hidden form value are built in.
What's included
- Enter, comma or paste to add tags
- Two-step Backspace removal
- Nudge instead of a duplicate
- Limit on number and length of tags
- Soft or solid tags
- Light and dark look
- Type
- Animated React input component
- Library
- Components · Input
- Stack
- Next.js, React, Tailwind CSS
- Added
- 2026-11-23
- Install
npx motionsnack add tag-input