npx shadcn@4.23.1 add @goop/meadow-fieldField
FreeA form row that ties one control to its label and its description, as a settings row or a stacked form field, for React and Tailwind CSS. Free, MIT.
Field
What an agent sees
- FieldValueThe row's current value, shown before its control (an address before its edit button)
import { FieldValue } from '@/components/ui/goop/field';
import { Button } from '@/components/ui/goop/button';
import { Field } from '@/components/ui/goop/field';
import {
Select,
SelectContent,
SelectIcon,
SelectItem,
SelectTrigger,
SelectValue,
} from '@/components/ui/goop/select';
import { TextInput } from '@/components/ui/goop/text-input';
function CalendarSettings() {
return (
<ul className="flex flex-col">
<Field as="li" label="Survey calendar" description="Site visits you create are added here.">
{(control) => (
<Select defaultValue="field">
<SelectTrigger size="lg" {...control}>
<SelectValue />
<SelectIcon />
</SelectTrigger>
<SelectContent aria-label="Calendars">
<SelectItem value="field">Field survey calendar</SelectItem>
<SelectItem value="office">Office calendar</SelectItem>
</SelectContent>
</Select>
)}
</Field>
<Field
as="li"
tone="danger"
stack="always"
label="Delete workspace"
description="Removes its plans and notes."
>
<Button variant="destructive" size="page">
Delete workspace
</Button>
</Field>
</ul>
);
}
function CrewForm() {
return (
<div className="flex flex-col gap-3">
<Field label="Start" orientation="vertical">
<TextInput defaultValue="08:30" />
</Field>
<Field label="Guest" orientation="inline">
<TextInput variant="bare" type="email" />
</Field>
</div>
);
}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
What an agent sees
- FieldValueThe row's current value, shown before its control (an address before its edit button)
import { FieldValue } from '@/components/ui/goop/field';
import { Button } from '@/components/ui/goop/button';
import { Field } from '@/components/ui/goop/field';
import {
Select,
SelectContent,
SelectIcon,
SelectItem,
SelectTrigger,
SelectValue,
} from '@/components/ui/goop/select';
import { TextInput } from '@/components/ui/goop/text-input';
function CalendarSettings() {
return (
<ul className="flex flex-col">
<Field as="li" label="Survey calendar" description="Site visits you create are added here.">
{(control) => (
<Select defaultValue="field">
<SelectTrigger size="lg" {...control}>
<SelectValue />
<SelectIcon />
</SelectTrigger>
<SelectContent aria-label="Calendars">
<SelectItem value="field">Field survey calendar</SelectItem>
<SelectItem value="office">Office calendar</SelectItem>
</SelectContent>
</Select>
)}
</Field>
<Field
as="li"
tone="danger"
stack="always"
label="Delete workspace"
description="Removes its plans and notes."
>
<Button variant="destructive" size="page">
Delete workspace
</Button>
</Field>
</ul>
);
}
function CrewForm() {
return (
<div className="flex flex-col gap-3">
<Field label="Start" orientation="vertical">
<TextInput defaultValue="08:30" />
</Field>
<Field label="Guest" orientation="inline">
<TextInput variant="bare" type="email" />
</Field>
</div>
);
}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
What an agent sees
- FieldValueThe row's current value, shown before its control (an address before its edit button)
import { FieldValue } from '@/components/ui/goop/field';
import { Button } from '@/components/ui/goop/button';
import { Field } from '@/components/ui/goop/field';
import {
Select,
SelectContent,
SelectIcon,
SelectItem,
SelectTrigger,
SelectValue,
} from '@/components/ui/goop/select';
import { TextInput } from '@/components/ui/goop/text-input';
function CalendarSettings() {
return (
<ul className="flex flex-col">
<Field as="li" label="Survey calendar" description="Site visits you create are added here.">
{(control) => (
<Select defaultValue="field">
<SelectTrigger size="lg" {...control}>
<SelectValue />
<SelectIcon />
</SelectTrigger>
<SelectContent aria-label="Calendars">
<SelectItem value="field">Field survey calendar</SelectItem>
<SelectItem value="office">Office calendar</SelectItem>
</SelectContent>
</Select>
)}
</Field>
<Field
as="li"
tone="danger"
stack="always"
label="Delete workspace"
description="Removes its plans and notes."
>
<Button variant="destructive" size="page">
Delete workspace
</Button>
</Field>
</ul>
);
}
function CrewForm() {
return (
<div className="flex flex-col gap-3">
<Field label="Start" orientation="vertical">
<TextInput defaultValue="08:30" />
</Field>
<Field label="Guest" orientation="inline">
<TextInput variant="bare" type="email" />
</Field>
</div>
);
}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
What an agent sees
- FieldValueThe row's current value, shown before its control (an address before its edit button)
import { FieldValue } from '@/components/ui/goop/field';
import { Button } from '@/components/ui/goop/button';
import { Field } from '@/components/ui/goop/field';
import {
Select,
SelectContent,
SelectIcon,
SelectItem,
SelectTrigger,
SelectValue,
} from '@/components/ui/goop/select';
import { TextInput } from '@/components/ui/goop/text-input';
function CalendarSettings() {
return (
<ul className="flex flex-col">
<Field as="li" label="Survey calendar" description="Site visits you create are added here.">
{(control) => (
<Select defaultValue="field">
<SelectTrigger size="lg" {...control}>
<SelectValue />
<SelectIcon />
</SelectTrigger>
<SelectContent aria-label="Calendars">
<SelectItem value="field">Field survey calendar</SelectItem>
<SelectItem value="office">Office calendar</SelectItem>
</SelectContent>
</Select>
)}
</Field>
<Field
as="li"
tone="danger"
stack="always"
label="Delete workspace"
description="Removes its plans and notes."
>
<Button variant="destructive" size="page">
Delete workspace
</Button>
</Field>
</ul>
);
}
function CrewForm() {
return (
<div className="flex flex-col gap-3">
<Field label="Start" orientation="vertical">
<TextInput defaultValue="08:30" />
</Field>
<Field label="Guest" orientation="inline">
<TextInput variant="bare" type="email" />
</Field>
</div>
);
}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
What an agent sees
- FieldValueThe row's current value, shown before its control (an address before its edit button)
import { FieldValue } from '@/components/ui/goop/field';
import { Button } from '@/components/ui/goop/button';
import { Field } from '@/components/ui/goop/field';
import {
Select,
SelectContent,
SelectIcon,
SelectItem,
SelectTrigger,
SelectValue,
} from '@/components/ui/goop/select';
import { TextInput } from '@/components/ui/goop/text-input';
function CalendarSettings() {
return (
<ul className="flex flex-col">
<Field as="li" label="Survey calendar" description="Site visits you create are added here.">
{(control) => (
<Select defaultValue="field">
<SelectTrigger size="lg" {...control}>
<SelectValue />
<SelectIcon />
</SelectTrigger>
<SelectContent aria-label="Calendars">
<SelectItem value="field">Field survey calendar</SelectItem>
<SelectItem value="office">Office calendar</SelectItem>
</SelectContent>
</Select>
)}
</Field>
<Field
as="li"
tone="danger"
stack="always"
label="Delete workspace"
description="Removes its plans and notes."
>
<Button variant="destructive" size="page">
Delete workspace
</Button>
</Field>
</ul>
);
}
function CrewForm() {
return (
<div className="flex flex-col gap-3">
<Field label="Start" orientation="vertical">
<TextInput defaultValue="08:30" />
</Field>
<Field label="Guest" orientation="inline">
<TextInput variant="bare" type="email" />
</Field>
</div>
);
}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
What an agent sees
- FieldValueThe row's current value, shown before its control (an address before its edit button)
import { FieldValue } from '@/components/ui/goop/field';
import { Button } from '@/components/ui/goop/button';
import { Field } from '@/components/ui/goop/field';
import {
Select,
SelectContent,
SelectIcon,
SelectItem,
SelectTrigger,
SelectValue,
} from '@/components/ui/goop/select';
import { TextInput } from '@/components/ui/goop/text-input';
function CalendarSettings() {
return (
<ul className="flex flex-col">
<Field as="li" label="Survey calendar" description="Site visits you create are added here.">
{(control) => (
<Select defaultValue="field">
<SelectTrigger size="lg" {...control}>
<SelectValue />
<SelectIcon />
</SelectTrigger>
<SelectContent aria-label="Calendars">
<SelectItem value="field">Field survey calendar</SelectItem>
<SelectItem value="office">Office calendar</SelectItem>
</SelectContent>
</Select>
)}
</Field>
<Field
as="li"
tone="danger"
stack="always"
label="Delete workspace"
description="Removes its plans and notes."
>
<Button variant="destructive" size="page">
Delete workspace
</Button>
</Field>
</ul>
);
}
function CrewForm() {
return (
<div className="flex flex-col gap-3">
<Field label="Start" orientation="vertical">
<TextInput defaultValue="08:30" />
</Field>
<Field label="Guest" orientation="inline">
<TextInput variant="bare" type="email" />
</Field>
</div>
);
}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
What an agent sees
- FieldValueThe row's current value, shown before its control (an address before its edit button)
import { FieldValue } from '@/components/ui/goop/field';
import { Button } from '@/components/ui/goop/button';
import { Field } from '@/components/ui/goop/field';
import {
Select,
SelectContent,
SelectIcon,
SelectItem,
SelectTrigger,
SelectValue,
} from '@/components/ui/goop/select';
import { TextInput } from '@/components/ui/goop/text-input';
function CalendarSettings() {
return (
<ul className="flex flex-col">
<Field as="li" label="Survey calendar" description="Site visits you create are added here.">
{(control) => (
<Select defaultValue="field">
<SelectTrigger size="lg" {...control}>
<SelectValue />
<SelectIcon />
</SelectTrigger>
<SelectContent aria-label="Calendars">
<SelectItem value="field">Field survey calendar</SelectItem>
<SelectItem value="office">Office calendar</SelectItem>
</SelectContent>
</Select>
)}
</Field>
<Field
as="li"
tone="danger"
stack="always"
label="Delete workspace"
description="Removes its plans and notes."
>
<Button variant="destructive" size="page">
Delete workspace
</Button>
</Field>
</ul>
);
}
function CrewForm() {
return (
<div className="flex flex-col gap-3">
<Field label="Start" orientation="vertical">
<TextInput defaultValue="08:30" />
</Field>
<Field label="Guest" orientation="inline">
<TextInput variant="bare" type="email" />
</Field>
</div>
);
}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
What an agent sees
- FieldValueThe row's current value, shown before its control (an address before its edit button)
import { FieldValue } from '@/components/ui/goop/field';
import { Button } from '@/components/ui/goop/button';
import { Field } from '@/components/ui/goop/field';
import {
Select,
SelectContent,
SelectIcon,
SelectItem,
SelectTrigger,
SelectValue,
} from '@/components/ui/goop/select';
import { TextInput } from '@/components/ui/goop/text-input';
function CalendarSettings() {
return (
<ul className="flex flex-col">
<Field as="li" label="Survey calendar" description="Site visits you create are added here.">
{(control) => (
<Select defaultValue="field">
<SelectTrigger size="lg" {...control}>
<SelectValue />
<SelectIcon />
</SelectTrigger>
<SelectContent aria-label="Calendars">
<SelectItem value="field">Field survey calendar</SelectItem>
<SelectItem value="office">Office calendar</SelectItem>
</SelectContent>
</Select>
)}
</Field>
<Field
as="li"
tone="danger"
stack="always"
label="Delete workspace"
description="Removes its plans and notes."
>
<Button variant="destructive" size="page">
Delete workspace
</Button>
</Field>
</ul>
);
}
function CrewForm() {
return (
<div className="flex flex-col gap-3">
<Field label="Start" orientation="vertical">
<TextInput defaultValue="08:30" />
</Field>
<Field label="Guest" orientation="inline">
<TextInput variant="bare" type="email" />
</Field>
</div>
);
}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 and its description, 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.
npx shadcn@4.23.1 add @goop/meadow-fieldAdd the Goop Field to this project. The install steps are at https://goop.so/docs/install.mdUsage
import { FieldValue } from '@/components/ui/goop/field';
import { Button } from '@/components/ui/goop/button';
import { Field } from '@/components/ui/goop/field';
import {
Select,
SelectContent,
SelectIcon,
SelectItem,
SelectTrigger,
SelectValue,
} from '@/components/ui/goop/select';
import { TextInput } from '@/components/ui/goop/text-input';
function CalendarSettings() {
return (
<ul className="flex flex-col">
<Field as="li" label="Survey calendar" description="Site visits you create are added here.">
{(control) => (
<Select defaultValue="field">
<SelectTrigger size="lg" {...control}>
<SelectValue />
<SelectIcon />
</SelectTrigger>
<SelectContent aria-label="Calendars">
<SelectItem value="field">Field survey calendar</SelectItem>
<SelectItem value="office">Office calendar</SelectItem>
</SelectContent>
</Select>
)}
</Field>
<Field
as="li"
tone="danger"
stack="always"
label="Delete workspace"
description="Removes its plans and notes."
>
<Button variant="destructive" size="page">
Delete workspace
</Button>
</Field>
</ul>
);
}
function CrewForm() {
return (
<div className="flex flex-col gap-3">
<Field label="Start" orientation="vertical">
<TextInput defaultValue="08:30" />
</Field>
<Field label="Guest" orientation="inline">
<TextInput variant="bare" type="email" />
</Field>
</div>
);
}- Fits: account, flow, settings (their recipes).
- Field is one piece:
labelanddescriptionare its props, with no label or description part to import. A bare Field is a settings row: rows go in aulon the page, or in aCard variant="outline"(the card on theul, or theulstraight in it), which sets them 12 px in and rules them; a form's label over its control isorientation="vertical". A select needs its trigger wired:<Field label="Default calendar">{(control) => (<Select><SelectTrigger {...control}><SelectValue /> </SelectTrigger>…</Select>)}</Field>. - FieldValue: A value with its edit button:
<Field label="Email">{(control) => (<><FieldValue>sam@example.com</FieldValue> <IconButton aria-label="Change email" {...control}>…</IconButton></>)}</Field>. - More on where it goes: field--options.md
- height, width, padding, gap, border, background, text: add no class for these.
API reference
| Option | Type | What it does |
|---|---|---|
| orientation | horizontal | vertical | inline = horizontal |
- Each option with its sentence: field--options.md
| Part | What it is |
|---|---|
| FieldValue | The 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
import { Field } from '@/components/ui/goop/field';Compose
- FieldValue: A value alone (a review step, a read-only fact) takes the control's id:
{(control) => <FieldValue id={control.id}>Rowan Hale</FieldValue>}.
Options
- orientation: horizontal (default), vertical, inline
- as?: 'div' | 'li' = 'div' —
limakes the row an item of its list (a settings list'sul); adivby default. - ref?: Ref<HTMLDivElement | HTMLLIElement> — The row's element: the
div, or theliwithas="li". - label: ReactNode — The control's name, shown over or before it; a press 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:
truedraws it always,falsenever; left out, it is drawn under every row but not under the last of its siblings (an inline row draws it under the last too). - disabled?: boolean — Dims the words to half and disables the control the field wires; off by default.
- media?: ReactNode — What the row shows before its words (an icon tile marking the row's subject).
- stack?: boolean | 'always' — Whether the row stacks its words above its control:
"always"at every width;trueany row at or below 640 px;falsenever (a field-shaped control stays beside its words). - tone?: 'default' | 'danger' = 'default' —
default;dangerdraws the title in the destructive red (a section that deletes or ends something). - children: ReactElement<Partial<FieldControlProps>> | ((control: FieldControlProps) => ReactNode) — The control (a Switch, TextInput, Select, Textarea or Slider) or a function given its wiring.
- Types: FieldControlProps = { id: string; 'aria-describedby'?: string; disabled?: boolean }
Accessibility
- hover: the browser's own (:hover): 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 attribute data-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.