[ Forms ]

Textarea

A multi-line text field with the same label, helper text and error handling as Input. Users can resize it vertically.

3 examplesDark modeAccessible

Import#

import { Textarea } from 'reusify-ui';

When to use#

  • Free-form text longer than one line: comments, descriptions, messages, addresses.
  • Set rows to roughly the length of the text you expect.

Examples#

Basic#

<Textarea label="Message" placeholder="Write your message…" rows={4} />

Character counter#

Combine maxLength with helperText to show the remaining characters.

0/160 characters

function BioField() {
  const [text, setText] = useState('');
  const max = 160;

  return (
    <Textarea
      label="Bio"
      value={text}
      maxLength={max}
      onChange={(e) => setText(e.target.value)}
      helperText={`${text.length}/${max} characters`}
    />
  );
}

Error#

Please write at least 20 characters

<Textarea label="Feedback" error="Please write at least 20 characters" defaultValue="Too short" />

API reference#

<Textarea />

Also accepts every native <textarea> attribute and forwards its ref.

rows4
number

Visible number of text lines.

label-
ReactNode

Label rendered above the control and linked to it via htmlFor.

helperText-
ReactNode

Hint shown below the control.

error-
boolean | string

Marks the field invalid (red border, aria-invalid). A string also replaces the helper text.

fullWidthfalse
boolean

Makes the field fill its container.

containerClassName-
string

Class for the outer wrapper. className goes on the native element.

requiredfalse
boolean

Native required, plus a red asterisk after the label.

disabledfalse
boolean

Disables and dims the field.

Accessibility#

  • Uses the same label / aria-describedby / aria-invalid wiring as Input.
  • The native resize handle stays available for users who need more room.