Skip to content

Inputs

Textarea

A multi-line text field for notes, descriptions and messages. It can grow with its content up to a maximum number of rows, and show a live character counter that warns as the limit gets close.

On this page
98 of 280 characters used

Ada sees this on the shared invoice.

Usage

components/ui/textarea.tsx
import { Field } from "@/components/ui/field";import { Textarea } from "@/components/ui/textarea"; export function Example() {  return (    <Field label="Notes">      <Textarea autoGrow showCount maxLength={500} />    </Field>  );}

Examples

Message composer

98 of 280 characters used

Ada sees this on the shared invoice.

Auto-grow

autoGrow resizes the field to fit what's typed, from rows up to maxRows, then scrolls. Type a few lines to try it.

Character counter

showCount displays the count; with maxLength it reads 42/160 and turns amber at 90% and red at the limit.

85 of 160 characters used
65 of 70 characters used

States

Tell us why so we can refund the right amount.

Locked after the invoice is sent.

Props

  • autoGrowbooleandefault: falseGrow with the content instead of scrolling.
  • rowsnumberdefault: 3Starting height in rows.
  • maxRowsnumberdefault: 10Height limit for autoGrow; scrolls beyond it.
  • showCountbooleandefault: falseLive character counter under the text. Uses maxLength as the limit.
  • maxLengthnumberdefault: —Native limit; the counter warns at 90%.
  • invalidbooleandefault: —Red border and aria-invalid. Set automatically by <Field error>.
  • classNamestringdefault: —Classes for the outer box.
  • textareaClassNamestringdefault: —Classes for the inner <textarea>.
  • ...propsTextareaHTMLAttributesdefault: —Any native textarea attribute: value, onChange, placeholder…

Accessibility

  • A native <textarea>, so all text editing keys, spell check and IME input work as expected.
  • Inside Field the label, hint and error are linked automatically (label for, aria-describedby, aria-invalid).
  • The counter is part of aria-describedby and reads as “42 of 160 characters used”, not just numbers.
  • maxLength is enforced by the browser; the amber and red counter colors are backed by the number itself, never color alone.

Suggested