---
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. Free, MIT.

Free. 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.

```sh
npx shadcn@4.23.1 add @goop/trail-field-error
```

```text
Add the Goop Field error to this project. The install steps are at https://goop.so/docs/install.md
```

## Usage

```tsx
import { FieldError, FieldInvalid } from '@/components/ui/goop/field-error';
import { Field } from '@/components/ui/goop/field';
import { TextInput } from '@/components/ui/goop/text-input';

<Field label="Work email">
  <FieldInvalid error="Enter an address with an @ in it.">
    <TextInput type="email" defaultValue="mira.example.com" />
  </FieldInvalid>
</Field>
```

- Fits: account, flow (their recipes).
- 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 — What is wrong and how to put it right; nothing, `false` or `''` shows no error; errorId?: string — The error line's id; a generated one when left out; id?: string — The control's id, handed on to it (never the group's); aria-describedby?: string — What else describes the control, handed on to it before the error's id; disabled?: boolean — Disables the control (never the group) and dims the error line with it; 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 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.

## Related

- [Field](/themes/trail/components/field): 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.
- [Text input](/themes/trail/components/text-input): A single-line field for free words, such as a name, a title or an email.
- [Textarea](/themes/trail/components/textarea): A multi-line field for free text, such as a description or a comment, that grows by rows as a person types.
- [Search input](/themes/trail/components/search-input): A search field with the search icon at its start, for narrowing a list or a page.
