npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/trail-input-group.json --yesInput group
ProA 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.
What an agent sees
- InputGroupInputThe field inside an InputGroup
- InputGroupAddonA holder of add-ons inside the frame
- InputGroupIconA pack icon in an add-on
- InputGroupTextA short text in an add-on — "https
- InputGroupButtonA quiet button of words in an add-on ("Apply", "Copy")
- InputGroupIconButtonA quiet icon button in an add-on (copy, show, open)
- InputGroupClearThe clear button in an add-on
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>
</>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.
npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/trail-input-group.json --yesAdd the Goop Input group to this project. The install steps are at https://goop.so/docs/install.mdUsage
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
| Option | Type | What it does |
|---|---|---|
| size | sm | md | lg = md | |
| id? | string | The field's id, handed to the InputGroupInput (a Field's label points at it). |
| aria-describedby? | string | What 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? | boolean | Disables the field and every button in the group; the frame dims. |
| Part | What it is |
|---|---|
| InputGroupInput | The 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 |
| InputGroupAddon | A holder of add-ons inside the frame; side: start (default), end |
| InputGroupIcon | A pack icon in an add-on; icon: IconName — The pack icon's own name |
| InputGroupText | A short text in an add-on — "https |
| InputGroupButton | A quiet button of words in an add-on ("Apply", "Copy"); its props: input-group--button.md |
| InputGroupIconButton | A quiet icon button in an add-on (copy, show, open); its props: input-group--icon-button.md |
| InputGroupClear | The clear button in an add-on; its props: input-group--clear.md |
InputGroupClear
The clear button in an add-on.
import { InputGroupClear } from '@/components/ui/goop/input-group';Options
- onClick?: (event: MouseEvent<HTMLButtonElement>) => unknown — The press: with
doneLabel, a promise it returns that resolves showsdoneLabel; one resolving tofalse, rejecting or callingevent.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'
Keyboard
| Key | What it does |
|---|---|
| Tab | Move from the field to each button inside its frame, in order, then on to the next control |
| Enter Space | On a button inside the frame: press it (the clear button empties the field and puts the focus back in it) |
| Escape | In 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:
| State | Drawn by |
|---|---|
| disabled | the prop disabled |
| invalid | the 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.