---
agent:
  instructions: "Search goop.so for Goop's components, templates, design skill, docs, pricing and terms. Ask in keywords or a plain question, such as \"date picker props\" or \"is the design skill free\"; the answer is the matching page sections in Markdown, each with its address."
  endpoint: "https://goop.so/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://developers.cloudflare.com/ai-search/how-to/search-for-agents/"
---

# Field error

The error line under a form control whose value was refused, saying what to fix, inside the control's Field, for React and Tailwind CSS. Part of Goop Pro.

Pro. Its export: `FieldError`.

## Try it

Type an email without an @ and leave the field: the error arrives under it. Type a username and leave it: it is checked for a moment, and a taken one (fieldwork, admin, teodora) is refused. Change the words and the error goes. Look switches stacked fields, settings rows, rows with a description, rows with a region (open its list and close it with nothing chosen), or errors that run on to more lines.

The username check is a timer over three names of our own.

## When to use

- The error line under a form control whose value was refused, saying what to fix, inside the control's Field.
- Also called: validation message or error text.

## 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 error 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.

```sh
npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/meadow-field-error.json --yes
```

```text
Add the Goop Field error 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 { FieldError, FieldInvalid } from '@/components/ui/goop/field-error';
import { TextInput } from '@/components/ui/goop/text-input';

function WorkEmail({ refused }: { refused?: string }) {
  const [email, setEmail] = useState('sam.rivera@');
  const error = /@[^@\s]+\.[^@\s]+$/.test(email) ? undefined : 'Enter a full address.';
  return (
    <div className="flex w-80 flex-col gap-3">
      <Field label="Work email" orientation="vertical" className="w-full">
        <FieldInvalid error={error}>
          <TextInput type="email" value={email} onChange={(event) => setEmail(event.target.value)} />
        </FieldInvalid>
      </Field>
      {refused ? <FieldError role="alert">{refused}</FieldError> : null}
    </div>
  );
}
```

- Fits: account, flow (their recipes).
- height, width, gap, text: add no class for these.

## API reference

### Parts

- `FieldInvalid` — A control and, when its value is refused, the error line under it; error?: ReactNode — The sentence that says what is wrong and how to put it right; nothing, `false` or `''` shows no error; errorId?: string — The error line's id, where the caller needs its own; a generated one otherwise; id?: string — The control's id, handed on to it (never the group's): the id a field holding the group points its label at; aria-describedby?: string — What else describes the control (a field's description), handed on to it before the error's id; disabled?: boolean — Disables the control (never the group) and dims the error line with it: a disabled field hands it on; children: ReactElement<FieldInvalidControlProps> | ((control: FieldInvalidControlProps) => ReactNode) — The control, or a function that spreads the wiring on a nested control

- data-slot values (to select a part by): field-error, field-error-group, field-error-icon, field-error-text

## Accessibility

- disabled: the 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.

## Related

- [Field](/themes/meadow/components/field): A form row that ties one control to its label and its description, as a settings row or a stacked form field.
- [Text input](/themes/meadow/components/text-input): A single-line field for free words, such as a task's title, a name or an email.
- [Textarea](/themes/meadow/components/textarea): A multi-line field for free words, such as a task's notes, a description, a comment or a message, that grows by rows as a person types.
- [Search input](/themes/meadow/components/search-input): A search field with the magnifier at its start, for narrowing a list or a page.
