Talisman LogoTalisman Logo Design System
Browse documentation
Components

Textarea

A multi-line text field for comments, justifications and other free-form text, with optional label, counter and description.

Stableimport { Textarea } from "@repo/ui/textarea";Source
0/500

Descreva o motivo da devolução para o revisor.

variant
<Textarea description="Descreva o motivo da devolução para o revisor." id="playground-observacao" label="Observação" placeholder="Escreva sua observação…" trailing="0/500" variant="default" />

TextAreaAutoResize is exported from the same module and is documented below.

When to use

  • To collect text longer than one line: review comments, justifications, case summaries.
  • When the length varies a lot and the user needs room to write.

When not to use

  • A short value on one line. Use Input.
  • A list of identifiers, such as process numbers. Use Textarea chips.
  • Rich text with formatting. The component only holds plain text.

Variants

variant sets the validation state. When no variant is passed, the field is default.

Estado blocked.

Estado default.

Estado error.

Estado success.

Variant Use for
default A field with no validation result yet.
error An invalid value. Colors the border and description.
success A value confirmed by the system.
blocked Text the user cannot change. Disables the field.

States

Hover and focus come from the browser: point at a field or press Tab to see them.

Counter

Use trailing for a character counter or a short note at the end of the label row.

0/500

Visível para o revisor e para o cliente.

Auto resize

TextAreaAutoResize grows with its content and takes the same variants, but has no label, trailing text or description. Pair it with a label of your own.

Content

  • Label with the noun: “Comentário da revisão”, “Observação”.
  • Use the placeholder for what to write, not for the label: “Escreva o comentário…”.
  • Use the description for limits and who reads the text: “Visível para o revisor e para o cliente.”

Do and don’t

DoPass id and label together so the label names the field.
Don'tDon't pass label without id. The label is not linked, so a screen reader announces an unnamed field.

Accessibility

  • It renders a native <textarea>, so resize, spell checking and autofill work.
  • The label uses Radix Label with htmlFor set from the id prop. Always pass id together with label: without it nothing links the two.
  • The description is not connected to the field with aria-describedby. Add the attribute yourself when the text matters.
  • Focus changes the border to the focus token and removes the native outline.
  • Without a visible label, pass aria-label.

Code

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

<Textarea
  description="Visível para o revisor e para o cliente."
  id="comentario"
  label="Comentário da revisão"
  rows={4}
  trailing="0/500"
/>;

Props

PropTypeDefaultDescription
descriptionstring—Helper or error text below the field. Its color follows `variant`
disabledbooleanfalseDisables the field
highlightbooleanfalseDraws a highlight border to call attention to the field
idstring—Id of the textarea. Required for the label to be linked to it
labelstring—Label above the field
placeholderstring—Text shown while the field is empty
rowsnumber—Number of visible text lines
trailingstring—Text at the end of the label row, such as a character counter
variant"blocked" | "default" | "error" | "success"defaultValidation state. `blocked` disables the field

Textarea also accepts every native <textarea> attribute, such as rows, maxLength, value, onChange and readOnly.

Known issues

Issue Effect
The label’s htmlFor comes from props.id, with no generated fallback. Without an id, the label is not linked to the field. Unlike Input, it does not generate one.
The description has no id and the field has no aria-describedby. Assistive technology does not read the description or the error with the field.
Hover uses hover:bg-neutral-black/5 and disabled uses disabled:opacity-50. Translucent fills, which the repository avoids. Disabled text loses contrast.
TextAreaAutoResize has no label, description or error text. It cannot show validation messages on its own, unlike Textarea.
Edit this page on GitHub