Tag Field
An input component that allows users to enter, display, and manage multiple tags or keywords dynamically. It supports adding, removing, and editing tags.
Installation
Install the component via the CLI in one command.
To install, run the following command:
npx shadcn@latest add @intentui/tag-field
Composed components
This tag field integrates with components like:
When you install this component via the CLI, it automatically loads all composed components, so you don’t need to add them individually.
Manual installation
Use this approach if you prefer to install and wire up the component yourself instead of using the CLI.
For manual installation, use:
npm install react-aria-components @heroicons/react tailwind-merge
Anatomy
Import the components and use them as shown below, adapting the structure to fit each component.
import { Label } from "@/components/ui/field"
import { Input } from "@/components/ui/input"
import { TagField } from "@/components/ui/tag-field"<TagField>
<Label/>
<Input/>
</TagField>Component API
TagField
The TagField component lets users enter and remove tags.
| Prop | Type | Default |
|---|---|---|
className | string | - |
defaultValue | string[] | [] |
inputValue | string | - |
isRequired | boolean | - |
name | string | tags |
onChange | (next: Selection) => void | - |
onInputValueChange | (v: string) => void | - |
requiredMessage | string | - |
splitPattern | RegExp | /[,;]/ |
value | Selection | - |
See the React Aria for the full API reference.
Unlock the full power ofIntent UI Design
Build modern web apps faster with 1000+ resources across components, blocks, patterns, templates, and starter kits.