Theme
Install with your agentnpx shadcn@4.23.1 add https://registry.goop.so/g/<link>/meadow-tags-input.json --yes

Tags input

Pro

A 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.

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.

Terminal
npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/meadow-tags-input.json --yes
PROMPT
Add the Goop Tags input to this project. The install steps are at https://goop.so/docs/install.md

Usage

TSX
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

Options
OptionTypeWhat it does
size?'sm' | 'md' | 'lg' | nullThe 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[]) => voidCalled with the tags each time one is added or removed.
max?numberThe most tags it holds; past it nothing more is added (no limit by default).
validate?(text: string, tags: readonly string[]) => booleanWhether a typed value may be a tag: refused, the text stays in the field, marked invalid until it changes.
markInvalid?(tag: string) => booleanMarks 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 = trueAdds what is typed when the field loses the focus.
removeLabel?(tag: string) => stringA tag's cross's spoken name, from the tag (default Remove <tag>).
onInputChange?(text: string) => voidCalled 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

KeyWhat 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
BackspaceIn the empty field: select the last tag; again: remove it
DeleteRemove the selected tag
ArrowLeft ArrowRightWalk from the field to the tags and back
EscapeDrop 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:

StateDrawn by
selectedthe attribute data-selected
disabledthe prop disabled
invalidthe 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.

goop.so/themes/meadow/components/tags-input.md · the page as Markdown
Theme
Install with your agentnpx shadcn@4.23.1 add https://registry.goop.so/g/<link>/meadow-tags-input.json --yes

Where would you like to start?

Free · now

The Goop plugin

A design system for your AI coding agent, so screen ten matches screen one.

/plugin marketplace add goop-so/skillsthen /plugin install goop@goopCodex, Cursor, ChatGPT, the Claude app and more: Connect Goop
FreePro

The components

Every part live, with its props, its keys and what an agent sees. Whole page and app templates, working with sample data.