ComponentClient component

Tag Input

A token field for creating, validating and removing free-form values with the keyboard.

Installation

Preview

Preview style
ReactTypeScriptTailwind CSS

Press Enter or comma to create a tag. Backspace removes the last one.

Usage

tsx
import { TagInput } from "@/components/ui/tag-input"

<TagInput
  defaultValue={["React", "TypeScript"]}
  maxTags={5}
  name="technologies"
  placeholder="Add technology..."
/>

API reference

PropTypeDefaultDescription
valuestring[]Controlled collection of tags.
onValueChange(value: string[]) => voidRuns whenever a tag is added or removed.
maxTagsnumberMaximum number of accepted tags.
validateTag(value: string) => booleanValidates a candidate before it is added.
delimitersstring[][","]Keys and pasted separators that create a tag.
classNamestringOverrides or extends the generated Tailwind classes.
disabledbooleanfalsePrevents user interaction when supported.