Component guideEditable source

Textarea

A native multi-line text field for longer input.

Original component docs
On this page4 sectionsBack to top

Use Textarea for descriptions, comments, and messages needing more than one line. It preserves native textarea behavior. Validation, character limits, and submission handling remain application responsibilities.

Live preview
Loading preview...

#Installation

Complete the base setup. For manual installation:

npx shadcn@latest add https://neobrutal-ui.andongmin.com/r/textarea.json

#Usage

import { Textarea } from "@/components/ui/textarea";

export default function ProjectDescription() {
  return (
    <div className="grid max-w-md gap-2">
      <label htmlFor="description">Project description</label>
      <Textarea
        id="description"
        name="description"
        rows={4}
        maxLength={500}
        aria-describedby="description-help"
      />
      <p id="description-help" className="text-sm">
        Describe the project in 500 characters or fewer.
      </p>
    </div>
  );
}

#API reference

PropPurposeDefault
value / onChangeControlled string and native eventUncontrolled
defaultValueInitial textEmpty
rowsInitial visible rowsBrowser default
maxLengthMaximum accepted charactersUnset
disabled / readOnly / requiredNative constraintsfalse
id / name / aria-describedbyLabel, submission key, supporting textUnset

#Accessibility

Keep a visible label and useful instructions outside the field. Associate character limits and errors with aria-describedby. Preserve resizing unless an equally usable alternative exists. Placeholder text is not a sufficient explanation.