npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/meadow-tags-input.json --yesTags input
ProA field a person types several short values into, each one a removable tag — labels, keywords, the emails to invite, for React and Tailwind CSS. Part of Goop Pro.
What an agent sees
import { useState } from 'react';
import { Field } from '@/components/ui/goop/field';
import { TagsInput } from '@/components/ui/goop/tags-input';
function Labels() {
const [labels, setLabels] = useState<string[]>(['interview']);
return (
<Field label="Labels" orientation="vertical" className="w-full">
<TagsInput value={labels} onValueChange={setLabels} placeholder="Add a label" max={5} />
</Field>
);
}
function Invitees() {
const [emails, setEmails] = useState<string[]>(['fatou@example.org', 'lupe@example']);
return (
<Field label="Invite" orientation="vertical" className="w-full">
<TagsInput
value={emails}
onValueChange={setEmails}
placeholder="Add an email"
markInvalid={(address) => !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(address)}
/>
</Field>
);
}Type a label and press Enter or a comma, paste several separated by commas, type one that is there already, press Backspace twice in the empty field to remove the last; invite up to five people by email, a word that is no address refused. Nothing is saved and no invitation is sent.
When to use
- A field a person types several short values into, each one a removable tag — labels, keywords, the emails to invite.
- Use TagsInput for values a person makes up; for values picked from a list use MultiSelect. Hand a refused value's reason to a FieldInvalid round it: the field marks itself invalid, the sentence is yours.
- Also called: chips input or token input.
Installation
Paste the prompt below into your coding agent. It reads Goop's install steps, installs the part and its tokens once, then reuses this same Tags input on every screen instead of drawing a new one: the same height, the same focus ring, the same spacing. As a Pro part, its command comes from Goop's server once you sign in, with a one-time link that lasts ten minutes.
npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/meadow-tags-input.json --yesAdd the Goop Tags input to this project. The install steps are at https://goop.so/docs/install.mdUsage
import { useState } from 'react';
import { Field } from '@/components/ui/goop/field';
import { TagsInput } from '@/components/ui/goop/tags-input';
function Labels() {
const [labels, setLabels] = useState<string[]>(['interview']);
return (
<Field label="Labels" orientation="vertical" className="w-full">
<TagsInput value={labels} onValueChange={setLabels} placeholder="Add a label" max={5} />
</Field>
);
}
function Invitees() {
const [emails, setEmails] = useState<string[]>(['fatou@example.org', 'lupe@example']);
return (
<Field label="Invite" orientation="vertical" className="w-full">
<TagsInput
value={emails}
onValueChange={setEmails}
placeholder="Add an email"
markInvalid={(address) => !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(address)}
/>
</Field>
);
}- Fits: settings, record: field.
- Also known as: TagInput, ChipInput, TokenInput, KeywordInput, EmailChips.
- height, width, padding, gap, corner, background, text: add no class for these.
API reference
| Option | Type | What it does |
|---|---|---|
| size? | 'sm' | 'md' | 'lg' | null | The field's height: sm 36 px, md 40 px (the default, the text input's), lg 44 px. |
| value? | readonly string[] | The tags, controlled. |
| defaultValue? | readonly string[] | The tags at first, uncontrolled (none if left out). |
| onValueChange? | (value: string[]) => void | Called with the tags each time one is added or removed. |
| max? | number | The most tags it holds; past it nothing more is added (no limit by default). |
| validate? | (text: string, tags: readonly string[]) => boolean | Whether a typed value may be a tag: refused, the text stays in the field, marked invalid until it changes. |
| markInvalid? | (tag: string) => boolean | Marks a tag that is in the field but not valid (such as an address your server refused): its chip takes the danger ring and a screen reader reads it as not valid. |
| addOnBlur? | boolean = true | Adds what is typed when the field loses the focus. |
| removeLabel? | (tag: string) => string | A tag's cross's spoken name, from the tag (default Remove <tag>). |
| onInputChange? | (text: string) => void | Called when the typed text changes, with the text. |
| messages? | Partial<TagsInputMessages> | What it says to a reader as its tags change; English by default. |
| name? | string | |
| required? | boolean | |
| disabled? | boolean | |
| form? | string |
- State: value (value / defaultValue / onValueChange); drawn by data-selected, data-invalid
- data-slot values (to select a part by): tags-input, tags-input-close, tags-input-input, tags-input-item, tags-input-label, tags-input-status
Keyboard
| Key | What it does |
|---|---|
| Enter / , | Add the typed words as a tag (one already there is not added again; a refused value stays, the field marked invalid); a pasted list adds every entry, a refused one as a tag marked invalid |
| Backspace | In the empty field: select the last tag; again: remove it |
| Delete | Remove the selected tag |
| ArrowLeft ArrowRight | Walk from the field to the tags and back |
| Escape | Drop the selection |
Accessibility
- The native element answers the keyboard.
- hover, focus: the browser's own (:hover, :focus): write nothing
Its states are drawn from attributes and props, so assistive technology and your agent read the same thing:
| State | Drawn by |
|---|---|
| selected | the attribute data-selected |
| disabled | the prop disabled |
| invalid | the attribute data-invalid |
Notes for AI
Give your coding agent this page as text instead of screenshots: the parts, the options, the states and the keys. An agent that reads the real part builds the real part, not a lookalike.