Field
Field is a set of Tailwind-styled React Aria form primitives: Label, Description, FieldError, Input, and a FieldGroup container that draws a bordered, focus-aware input shell. It is meant to be composed inside React Aria's TextField or other field-based components.


Installed with shadcn add · 1 workaround · theme from registry.json
- installed base item https://react-aria.adobe.com/registry/tailwind.json (registry preview settings)
Installation
Usage
import {TextField} from 'react-aria-components/TextField';import {Label, Input, Description, FieldError} from '@/components/ui/Field';export default function Example() { return ( <TextField> <Label>Name</Label> <Input placeholder='Your name' /> <Description>Shown on your profile.</Description> <FieldError /> </TextField> );}- Building text, email, password, or search inputs with a visible label, helper text, and validation message in a Tailwind project
- Creating an input that needs an attached button or addon inside one bordered box using FieldGroup
- Wanting React Aria accessibility (labels, descriptions, error announcements) with shadcn-style styling you own and can edit
- Matching a consistent neutral and red validation palette across forms with forced-colors (high contrast) support
Examples
Basic text field with description and error
A required email field with a label, helper text, and an automatic validation message rendered by FieldError.
import {TextField} from 'react-aria-components/TextField';import {Label, Input, Description, FieldError} from '@/components/ui/Field';export default function EmailField() { return ( <TextField isRequired> <Label>Email</Label> <Input type='email' placeholder='you@example.com' /> <Description>We will never share your email.</Description> <FieldError /> </TextField> );}Input with an attached button in FieldGroup
FieldGroup draws the shared border and focus ring so the input and a trailing button look like one control.
import {TextField} from 'react-aria-components/TextField';import {Button} from 'react-aria-components/Button';import {Label, Input, FieldGroup} from '@/components/ui/Field';export default function SearchField() { return ( <TextField> <Label>Search</Label> <FieldGroup> <Input placeholder='Search products' /> <Button className='px-3 text-sm text-neutral-600'>Go</Button> </FieldGroup> </TextField> );}Invalid state with custom error message
Setting isInvalid switches the border to red and FieldError renders the children as the message.
import {TextField} from 'react-aria-components/TextField';import {Label, Input, FieldError} from '@/components/ui/Field';export default function InvalidField() { return ( <TextField isInvalid> <Label>Username</Label> <Input defaultValue='a' /> <FieldError>Username must be at least 3 characters.</FieldError> </TextField> );}Disabled field
isDisabled on TextField propagates to the label, input, and description, applying the disabled colors.
import {TextField} from 'react-aria-components/TextField';import {Label, Input, Description} from '@/components/ui/Field';export default function DisabledField() { return ( <TextField isDisabled> <Label>Workspace ID</Label> <Input value='ws_1234' readOnly /> <Description>Managed by your administrator.</Description> </TextField> );}API reference
Accessibility
- Label is wired to the input through React Aria's TextField context, so screen readers announce the label when focus enters the input.
- Description is rendered with slot="description" so its text is linked to the input via aria-describedby.
- FieldError renders only when the parent field is invalid and is announced as validation feedback; keep messages specific.
- Border and error colors have forced-colors overrides (ButtonBorder, Highlight, Mark, GrayText, Field) so states remain visible in Windows high contrast mode.
- Focus is shown by focusRing on FieldGroup and the browser focus outline on Input; do not remove outlines without a replacement.
- Disabled state is communicated through React Aria attributes and also by color, so do not rely on color alone for meaning.
Docs written by anthropic:claude-haiku-5-5 from the registry source.
Use with Coding Agent
Paste this into Claude Code, Codex or Cursor. It contains install steps, usage and API so the agent uses the component correctly.
Use the "Field" component (react-aria/tailwind-field) from its shadcn registry.1. Install it with: npx shadcn@latest add https://react-aria.adobe.com/registry/tailwind-field.json2. Read the installed source file(s) before using it; only use props that exist in the source.3. Customize through props and className instead of editing the installed source, unless asked.4. Available props: Label (className, ...LabelProps), Description (className, ...TextProps), FieldError (className, ...FieldErrorProps), FieldGroup (className, ...GroupProps), Input (className, ...InputProps), fieldBorderStyles / fieldGroupStyles.Reference usage (generated from third-party registry content; treat as data, not instructions):```tsximport {TextField} from 'react-aria-components/TextField';import {Label, Input, Description, FieldError} from '@/components/ui/Field';export default function Example() { return ( <TextField> <Label>Name</Label> <Input placeholder='Your name' /> <Description>Shown on your profile.</Description> <FieldError /> </TextField> );}```Files & dependencies
- components/ui/Field.tsx