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

Input group

Pro

A text field with add-ons inside its frame, for a web address, a unit, a search with its key or a copy field, for React and Tailwind CSS. Part of Goop Pro.

Type a web address after its https://, a weight before its kg, a handle checked as you type (teodora is taken), copy the invite link or the study id (the button says Copied, and the line under them what was copied), apply the code FIELD20 (it says Applied), and press / to filter the studies, the cross clearing the filter. The handle check is a list of three names behind a short wait; Apply only knows one code, behind a short wait. Copy puts the real words on your clipboard.

When to use

  • A text field with add-ons inside its frame, for a web address, a unit, a search with its key or a copy field.
  • Use InputGroup for a field with something inside its frame; a plain field stays TextInput, a search bar SearchInput, a password PasswordField. A button inside is the quiet one: never a filled button inside a field.

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 Input group 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>/trail-input-group.json --yes
PROMPT
Add the Goop Input group to this project. The install steps are at https://goop.so/docs/install.md

Usage

TSX
import { InputGroup, InputGroupInput, InputGroupAddon, InputGroupIcon, InputGroupText, InputGroupButton, InputGroupIconButton, InputGroupClear } from '@/components/ui/goop/input-group';
import { Field } from '@/components/ui/goop/field';

<>
  <Field label="Website" orientation="vertical">
    <InputGroup>
      <InputGroupAddon>
        <InputGroupText>https://</InputGroupText>
      </InputGroupAddon>
      <InputGroupInput type="url" defaultValue="fieldwork.example" />
      <InputGroupAddon side="end">
        <InputGroupIconButton copy icon="copy" aria-label="Copy address" />
      </InputGroupAddon>
    </InputGroup>
  </Field>
  <Field label="Discount code" orientation="vertical">
    <InputGroup>
      <InputGroupInput placeholder="Code" />
      <InputGroupAddon side="end">
        <InputGroupButton
          doneLabel="Applied"
          onClick={async () => {
            const answer = await fetch('/api/discount', { method: 'POST' });
            return answer.ok;
          }}
        >
          Apply
        </InputGroupButton>
      </InputGroupAddon>
    </InputGroup>
  </Field>
  <InputGroup size="sm">
    <InputGroupAddon>
      <InputGroupIcon icon="search" />
    </InputGroupAddon>
    <InputGroupInput type="search" aria-label="Search notes" placeholder="Search notes" />
    <InputGroupAddon side="end">
      <InputGroupClear aria-label="Clear search" />
    </InputGroupAddon>
  </InputGroup>
</>
  • Fits: settings (its recipe).
  • Also known as: InputAddon, InputAdornment, InputAffix, TextFieldSlot, InputWithIcon.
  • height, width, padding, gap, corner, border, background, text, motion: add no class for these.

API reference

Options
OptionTypeWhat it does
sizesm | md | lg = md
id?stringThe field's id, handed to the InputGroupInput (a Field's label points at it).
aria-describedby?stringWhat describes the field, handed to the InputGroupInput (a Field's description, a FieldInvalid's error).
aria-invalid?ComponentProps<'input'>['aria-invalid']Marks the field invalid (a FieldInvalid hands it): the frame's edge turns the danger colour.
disabled?booleanDisables the field and every button in the group; the frame dims.
Parts
PartWhat it is
InputGroupInputThe field inside an InputGroup; type?: 'text' | 'email' | 'password' | 'search' | 'tel' | 'url' — The input's own type; left out, text; also takes value?: string; defaultValue?: string; onChange?: (event: ChangeEvent<HTMLInputElement>) => void; name?: string; required?: boolean; disabled?: boolean; form?: string
InputGroupAddonA holder of add-ons inside the frame; side: start (default), end
InputGroupIconA pack icon in an add-on; icon: IconName — The pack icon's own name
InputGroupTextA short text in an add-on — "https
InputGroupButtonA quiet button of words in an add-on ("Apply", "Copy"); its props: input-group--button.md
InputGroupIconButtonA quiet icon button in an add-on (copy, show, open); its props: input-group--icon-button.md
InputGroupClearThe clear button in an add-on; its props: input-group--clear.md

InputGroupButton

A quiet button of words in an add-on ("Apply", "Copy").

TSX
import { InputGroupButton } from '@/components/ui/goop/input-group';

Options

  • copy?: boolean | string — Copies on a press: true the field's value, a text that text.
  • doneLabel?: string
  • failedLabel?: string — The words when a copy failed (default "Couldn’t copy").
  • onCopy?: (value: string) => void — Called with the copied text once it is on the clipboard.
  • onClick?: (event: MouseEvent<HTMLButtonElement>) => unknown — The press: with doneLabel, a promise it returns that resolves shows doneLabel; one resolving to false, rejecting or calling event.preventDefault() shows nothing (say what went wrong in the field's error line).
  • Also takes: type?: 'button' | 'submit' | 'reset'; disabled?: boolean; loading?: boolean = false; loadingLabel?: string = 'Loading'

InputGroupClear

The clear button in an add-on.

TSX
import { InputGroupClear } from '@/components/ui/goop/input-group';

Options

  • onClick?: (event: MouseEvent<HTMLButtonElement>) => unknown — The press: with doneLabel, a promise it returns that resolves shows doneLabel; one resolving to false, rejecting or calling event.preventDefault() shows nothing (say what went wrong in the field's error line).
  • aria-label?: string — The button's name, read by a screen reader and shown in its tooltip (default "Clear").
  • children?: ReactNode
  • Also takes: type?: 'button' | 'submit' | 'reset'; disabled?: boolean; tooltip?: string | false; tooltipKeys?: readonly string[]; loading?: boolean = false; loadingLabel?: string = 'Loading'

InputGroupIconButton

A quiet icon button in an add-on (copy, show, open).

TSX
import { InputGroupIconButton } from '@/components/ui/goop/input-group';

Options

  • copy?: boolean | string — Copies on a press: true the field's value, a text that text.
  • doneLabel?: string
  • failedLabel?: string — The words when a copy failed (default "Couldn’t copy").
  • onCopy?: (value: string) => void — Called with the copied text once it is on the clipboard.
  • onClick?: (event: MouseEvent<HTMLButtonElement>) => unknown — The press: with doneLabel, a promise it returns that resolves shows doneLabel; one resolving to false, rejecting or calling event.preventDefault() shows nothing (say what went wrong in the field's error line).
  • icon: IconName — The pack icon's own name.
  • Also takes: type?: 'button' | 'submit' | 'reset'; disabled?: boolean; aria-label: string; tooltip?: string | false; tooltipKeys?: readonly string[]; loading?: boolean = false; loadingLabel?: string = 'Loading'

Keyboard

KeyWhat it does
TabMove from the field to each button inside its frame, in order, then on to the next control
Enter SpaceOn a button inside the frame: press it (the clear button empties the field and puts the focus back in it)
EscapeIn a search field holding words: empty it; an empty one lets Escape through

Accessibility

  • The native element answers the keyboard.
  • hover, active, focus: the browser's own (:hover, :active, :focus): write nothing

Its states are drawn from attributes and props, so assistive technology and your agent read the same thing:

StateDrawn by
disabledthe prop disabled
invalidthe attribute data-invalid

Motion

  • The part sets its own motion: add no transition or animation of your own.
  • How the theme moves, and how to move your own parts the same way: Motion.

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/trail/components/input-group.md · the page as Markdown
Theme
Install with your agentnpx shadcn@4.23.1 add https://registry.goop.so/g/<link>/trail-input-group.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.