Skip to main content
On this page

A form field for collecting multi-line free-form text

When to use​

  • When the user needs to enter free-form text that is likely to span multiple lines, such as a description, notes, or an explanation
  • When the length of the response is unpredictable and cannot be constrained to a single line
  • When the content the user writes may benefit from being visible in full while they compose it

When not to use​

  • For single-line inputs such as names, phone numbers, or reference codes - use Text Field instead, which signals to the user that a short response is expected.
  • For structured data that can be broken into discrete fields - an address, for example, is better collected with multiple Text Fields than a single textarea.
  • When only a small number of characters are expected - the visual size of the textarea communicates how much text is expected. A large textarea for a short answer creates a mismatch that confuses users.
  • To indicate that a field is unavailable - the disabled state is not supported. Use Summary List to show values that cannot be edited, or conditionally hide the field if it is not relevant in the current context.

Anatomy​

  1. Label
  2. Hint
  3. Textarea input
  4. Error message
  5. Required/Optional indicator

Basic usage​

Loading...
Edit live code
<TextareaField id="description" label="Description" />

Variants and features​

Controlling height with rows​

Use the rows prop to set the initial visible height of the textarea. The default is three rows. Set rows to match the expected volume of text. A field for a short description might need three rows; one for a detailed complaint or explanation might need eight or more.

Loading...
Edit live code
<TextareaField id="description-rows" label="Description" rows={5} />

Resizable​

Set resizable to allow users to drag the bottom of the textarea to increase its height. Use this when the amount of text the user might enter is unpredictable. The textarea can only be resized vertically.

Loading...
Edit live code
<TextareaField id="description-resizable" label="Description" resizable />

Character count​

Use the characterLimit prop to show a live "count/limit" counter below the input. The limit is advisory: it does not stop the user typing past it, but the counter turns to the error colour and screen readers are told how many characters remain or are over.

To set the width of the textarea rather than a counter, use characters instead.

Loading...
Edit live code
<TextareaField id="comment" label="Comment" characterLimit={50} />

Common form features​

For validation, hint text, required/optional labelling, and field width, see the Form guidance. These features are shared across all Nebula form fields.

Grouping​

Textarea fields are typically part of a larger form. See the Form component and form guidelines for guidance on grouping and layout.