Theme
Install with your agentnpx shadcn@4.23.1 add @goop/trail-field

Field

Free

A form row that ties one control to its label, its description and its error line, as a settings row or a stacked form field, for React and Tailwind CSS. Free, MIT.

Field

Turn the settings on and off by the switch, its label or Space: each change saves at once and the line under the list says so. Text alerts are refused and the switch goes back. The save is a timer; the refusal is our own rule (the sample account has no phone number).

Field avatar

Press the round avatar (or Tab to it and press Enter) and choose a picture: it shows at once and uploads for a moment. A file over 2 MB or not a picture is refused in the row; Remove puts the initials back. The upload is a timer; the picture never leaves the page. The theme ships no picture chooser for this row: the avatar-as-button and its hidden file field are this example’s own composition.

Field button

Press Export: the button is busy for a moment, then the row says the file is ready. Press Sign out: the other sessions end and the button switches off. Both are timers: no file is made and no one is signed out.

Field edit

Press the pencil to edit the address in place and Save: an address without an @, or lucia@fieldwork.test (in use), is refused under the field; a good one is saved after a moment. Cancel or Escape leave it as it was; the focus returns to the pencil. The save is a timer; the address in use is our own sample.

Field icon

Press an icon to cycle it and type the name; Look puts the pairs in two settings rows or bare as a form’s title line. In the rows, switch row or column, the hairline, stacking on a phone (seen under 641 px) and invalid; disable them in either. Nothing is saved; the picker cycles five icons instead of opening a list.

Field select

Choose a start page or how names are shown: each choice saves at once (the line under the list says so) and the row’s description follows the name choice. The save is a timer; the name is our own sample.

Field stacked

Type a start and an end; switch the column to a row, add a description, disable the fields, mark the end invalid. The times are not checked: "Invalid" only marks the end box.

Field tile

Press a row’s words or its switch to turn it on; switch row or column, the hairline, stacking on a phone (seen under 641 px), disabled, the descriptions and the tiles. Nothing is saved: the rows only say their state.

When to use

  • A form row that ties one control to its label, its description and its error line, as a settings row or a stacked form field.
  • Also called: form field or form control.

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 Field on every screen instead of drawing a new one: the same height, the same focus ring, the same spacing.

Terminal
npx shadcn@4.23.1 add @goop/trail-field
PROMPT
Add the Goop Field to this project. The install steps are at https://goop.so/docs/install.md

Usage

TSX
import { Field, FieldValue } from '@/components/ui/goop/field';
import { Card } from '@/components/ui/goop/card';
import { Switch } from '@/components/ui/goop/switch';
import { MultiSelect, MultiSelectItem } from '@/components/ui/goop/multi-select';

<Card variant="outline" asChild>
  <ul>
    <Field as="li" label="Weekly digest" description="A summary every Monday">
      {(control) => <Switch {...control} />}
    </Field>
    <Field as="li" label="Who takes part" description="Every group the study recruits from" stack="always">
      <MultiSelect defaultValue={['Clinic staff']} placeholder="Choose who takes part">
        <MultiSelectItem value="Clinic staff">Clinic staff</MultiSelectItem>
        <MultiSelectItem value="Night shift">Night shift</MultiSelectItem>
        <MultiSelectItem value="Patients">Patients</MultiSelectItem>
      </MultiSelect>
    </Field>
  </ul>
</Card>
  • Fits: account, flow, settings, schedule (their recipes).
  • Field is one piece: label and description are its props, with no label or description part to import, and a bare Field is a settings row (orientation="horizontal"); a form's label over its control is orientation="vertical". A row's control is one line tall: the row centres its words against it, so a tall control (a RadioGroup, a column of checkboxes) leaves the label floating at the row's middle, far from the first option on a wide page. Put a choice of a few short options in a Select in the row; put options that need their own words (a size and its price) in orientation="vertical" (the label over the group, the group named by aria-label), or under a heading of their own.
  • More on where it goes: field--options.md
  • height, width, padding, gap, background, text: add no class for these.

API reference

Options
OptionTypeWhat it does
orientationhorizontal | vertical = horizontal
Parts
PartWhat it is
FieldValueThe row's current value, shown before its control (an address before its edit button)
  • Class recipes (cva): fieldVariants (Field)
  • data-slot values (to select a part by): field, field-content, field-control, field-description, field-label, field-media, field-value

Field: every option

TSX
import { Field } from '@/components/ui/goop/field';

Compose

  • A vertical field has no inside of its own: in a list of rows give the row stack="always" instead; a group that is no Field (a ChoiceGroup) is held in an li with p-4 max-narrow:px-2.5.
  • FieldValue: A value with its edit button: <Field label="Email">{(control) => (<><FieldValue>sam@example.com</FieldValue> <IconButton … {...control}>…</IconButton></>)}</Field>. A value alone (a read-only fact) takes the control's id: <FieldValue id={control.id}>.

Options

  • orientation: horizontal (default), vertical
  • as?: 'div' | 'li' = 'div' — li makes the row an item of its list (a settings list's ul); a div by default.
  • ref?: Ref<HTMLDivElement | HTMLLIElement> — The row's element: the div, or the li with as="li".
  • label: ReactNode — The control's name, shown over or before it; a click on it reaches the control.
  • description?: ReactNode — A grey line under the label, read out with the control; none by default.
  • separator?: boolean — The hairline under the row: true draws it always, false never; left out, it is drawn under every row but not under the last of its siblings.
  • disabled?: boolean — Dims the words to half and disables the control the field wires (a link takes no disabled); off by default.
  • media?: ReactNode — What the row shows before its words — the theme's IconTile marking the row's subject.
  • stack?: boolean | 'always' — Whether the row stacks its words above its control: "always" at every width (a MultiSelect, a Textarea or a long Select in a settings list); true at or below 640 px; false never.
  • children: ReactElement<Partial<FieldControlProps>> | ((control: FieldControlProps) => ReactNode) — The control (a Switch, TextInput, Select, Textarea or Slider) or a function given its wiring.
  • Another example of it: field-error.md, input-group.md, rating.md, textarea.md
  • Types: FieldControlProps = { id: string; 'aria-describedby'?: string; disabled?: boolean }

Keyboard

KeyWhat it does
SpaceToggle
ArrowDown ArrowUpMove highlight
EnterChoose highlighted
EscapeDismiss

Accessibility

  • The part itself answers the keys above.
  • hover, active, focus-visible, focus-within: the browser's own (:hover, :active, :focus-visible, :focus-within): write nothing

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

StateDrawn by
checkedthe prop defaultChecked
disabledthe prop disabled

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/field.md · the page as Markdown
Theme
Install with your agentnpx shadcn@4.23.1 add @goop/trail-field

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.