1. Docs
  2. Components
  3. TextField

TextField

A text field allows a user to enter a plain text value with a keyboard.

Installation

Overview

TextField is a behavior and accessibility layer built on React Aria. It is not a visual component—it provides:

  • Automatic ID wiring between label, input, description, and error
  • Validation state management
  • Keyboard and focus handling
  • ARIA attributes for screen readers

TextField is designed to be composed into the Field component, which handles layout and visual structure.

Before you start

TextField is not responsible for:

  • Layout or visual structure
  • Rendering labels, descriptions, or error messages
  • Styling or positioning

For complete form fields, use Field as your composition root. TextField handles behavior; Field handles presentation.

Recommended reading:

Anatomy

TextField wraps your input and connects it to Field's label, description, and error elements.

The render prop on Field.Root accepts the TextField component. This pattern allows Field to provide layout while TextField provides behavior.

Examples

Basic

With Description

With Icon

Password

Validation

TextField integrates with React Aria's validation system. Use isRequired, isInvalid, or custom validation.

Form

TextField works with the Form component for submission and validation.

Props

TextField accepts all props from React Aria's TextField.

PropTypeDefaultDescription
typestring"text"Input type (email, password, etc.)
isRequiredbooleanfalseWhether the field is required
isInvalidbooleanfalseWhether the field is in error state
isDisabledbooleanfalseWhether the field is disabled
isReadOnlybooleanfalseWhether the field is read-only
valuestringControlled value
defaultValuestringDefault value (uncontrolled)
onChange(value: string) => voidCalled when value changes
namestringForm field name
autoCompletestringAutocomplete hint
maxLengthnumberMaximum character length
minLengthnumberMinimum character length
patternstringValidation pattern

Accessibility

When TextField is composed with Field:

  • Field.Label is automatically associated via aria-labelledby
  • Field.Description is associated via aria-describedby
  • Field.Error is associated via aria-describedby when invalid
  • Focus management and keyboard navigation are handled automatically

Without TextField

If you use Field.Root with Input directly (without TextField), you must manually wire IDs:

This approach loses React Aria's automatic association and is not recommended for production forms.