Back to elements
Element•Premium

Tag Input

A chip-style tag field with autocomplete suggestions, keyboard navigation, comma and paste splitting, a max limit, validation, and duplicate protection.

What are you great at?

Add skills to your profile so the right teams can find you.

3/6
ReactTypeScriptDesign systems

Press Enter or , to add · ⌫ to remove

Customize

Overview

About the Tag Input

A chip-style tag field with autocomplete suggestions, keyboard navigation, comma and paste splitting, a max limit, validation, and duplicate protection. It is delivered as editable TypeScript for React. Tailwind CSS is not required; the component's visual CSS is embedded in its TypeScript source. Its focused API can be adapted to your own content and visual system.

Usage

When to use it

  • Profile skills, topics, and labels where people add several short values.
  • Filters, invites, and keyword fields that combine suggestions with free text.

What’s included

Files in the product ZIP

Tag Input source

components/tag-input.tsx

Editable React and TypeScript component source.

Working example

examples/example.tsx

A minimal import and render example that matches the packaged API.

Installation guide

README.md

Manual ZIP installation, styling, compatibility, asset, and usage notes.

Usage

Import and render

Copy the packaged source to the documented path, then use the public API shown below.

Import
import { TagInput } from "@/components/tag-input";
Minimum example
export default function SkillsField() {
  return <TagInput label="Skills" name="skills" suggestions={["React", "TypeScript", "Figma"]} max={5} />;
}

Props

Component API

PropTypeDefaultDescription
labelstring"Tags"Visible field label.
valuestring[]—Controlled tags.
defaultValuestring[][]Initial tags when uncontrolled.
onChange(tags: string[]) => void—Called when tags are added or removed.
suggestionsstring[][]Autocomplete options.
maxnumber—Maximum number of tags.
allowCustombooleantrueAllow tags that are not in suggestions.
allowDuplicatesbooleanfalseAllow the same tag more than once.
validate(tag: string) => string | true—Return an error message to reject a tag.
accentstring"#a78bfa"Chip and focus color.
classNamestring""Additional root class names.

With name set, a hidden input submits the tags as a comma-separated value.

Compatibility

Verified project setup

  • ReactLoom's preview is tested with Next.js 16.3.8 App Router, React 19.2.8, TypeScript 5.9.3, and Tailwind CSS 4.3.3. This describes the store environment, not the product's minimum requirements.
  • This interactive component includes the "use client" directive and must remain behind a Client Component boundary in the Next.js App Router.
  • Tailwind CSS is not required; the component's visual CSS is embedded in its TypeScript source.
Images
No image files are included or required by the packaged component.
Fonts
No font files are included. The component uses system font fallbacks unless your app supplies a matching font.

Installation

Add it to your project

Download the Tag Input ZIP, place the source file at src/components/tag-input.tsx, and copy the example into your own page or feature folder.

Target path

src/components/tag-input.tsx

No additional npm runtime packages are required beyond the React host; follow the styling requirements below.

Styling requirements

  • Tailwind CSS is not required by this component.
  • All component styles are embedded in components/tag-input.tsx.