Text Area

React Text Area components are used to collect longer, multi-line text input from users. They are commonly used for messages, descriptions, feedback forms, comments, and notes where a single-line input is not sufficient.

Installation

Install the component using the Tailgrids CLI.

npx @tailgrids/cli add text-area

Anatomy

Import the component and pass the required props.

import { TextArea } from "@/components/tailgrids/core/text-area";

export default function TextAreaExample() {
  return (
    <TextArea name="message" placeholder="Write your message..." rows={5} />
  );
}

Examples

Basic Usage

Compose the TextArea component with a Label and optional Description for a complete form field.

Tell us a little about yourself.

Controlled

Create a controlled textarea by passing value and onChange props to manage the input state externally.

Characters typed: 40

Uncontrolled

Add defaultValue prop to the container field to pass an initial value.

An uncontrolled textarea manages its own state internally, without external control.

Note: React Aria manages inputs through context, so the defaultValue prop must be passed to the container field (TextField) rather than the TextArea itself for uncontrolled usage.

States

Pass state for visual variants like error and success. Use the Description or FieldError component to provide feedback messages for each state.

Saved successfully.
Please fix the highlighted issue.

Disabled

Prevent user interaction and reflect an inactive state by setting the disabled prop to true.

Note: disabled prop can be passed to either the TextArea or the container field (TextField) to disable the entire field.

Rows

Control the visible row count with the native rows prop.

With Validation

Validation can be implemented through the container field (TextField) using the validate prop. The invalid prop can also be used to manually set the error state.

Add enough detail so we can respond with the right context.

API Reference

TextArea

Extends the native textarea element props and the React Aria textarea primitive props.

PropTypeDefaultDescription
state'default' | 'error' | 'success''default'Tailgrids visual state variant.
valuestring-Controlled textarea value.
defaultValuestring-Uncontrolled initial value. (Not encouraged to use. Use on field container)
onChange(value: string) => void-Called when the value changes.
rowsnumber4Native textarea row count.
namestring-Name used when submitting a form.
placeholderstring-Hint text shown when the field is empty.
disabledbooleanfalseDisables the textarea programmatically.
readOnlybooleanfalsePrevents editing while keeping the value selectable.
requiredbooleanfalseMarks the field as required by native form validation.
classNamestring-Additional classes for customization.

Accessibility

  • Use a visible Label element when the field needs an accessible name.
  • Use a description slot or helper text for supplemental guidance.
  • The textarea remains a semantic <textarea> element and supports native keyboard interaction.
  • Disabled, read-only, and invalid states are communicated visually and programmatically.
  • When used inside a React Aria Form, validation can be driven by validationBehavior, required, and custom validation logic.