Skip to content
Fleetline

Textarea

Usage

Use a textarea for answers longer than a sentence: defect descriptions, handover notes, reasons for a rejected inspection. Use a text field for single-line answers like a plate number or a part code.

Anatomy

  1. Container — textarea.textarea; same border, radius and states as the text field
  2. Value / placeholder text
  3. Resize handle (vertical only; hidden when auto-grow, read-only or disabled)
  4. Counter (optional) — .field__counter wired with data-counter

Examples

Hover and focus-visible are frozen with .is-hover and .is-focus-visible, which share their rules with the real pseudo-classes.

Textarea

Notes are locked once the work order is closed.

Error: Enter the reason the vehicle failed inspection.

Grows as you type, up to 12 lines.

Sent as a text message to the driver's phone.

Up to 160 characters

<textarea class="textarea" id="defect" name="defect" rows="4"></textarea>
      <textarea class="textarea" … disabled>   <textarea class="textarea" … readonly>
      <textarea class="textarea" … aria-invalid="true" aria-describedby="defect-error"></textarea>

      <!-- Auto-grow (field-sizing: content where supported; rows + resize elsewhere) -->
      <textarea class="textarea textarea--auto-grow" rows="2" style="--textarea-max-rows: 12"></textarea>

      <!-- Counter: js/form-field.js → init(root) -->
      <textarea class="textarea" id="msg" data-counter="msg-count" aria-describedby="msg-count"></textarea>
      <p class="field__counter" id="msg-count" data-max="160">Up to 160 characters</p>

API

HookValuesPurpose
.textareablock classBordered multi-line input
.textarea--auto-growmodifier classContent-sized between min and max rows
--textarea-min-rows, --textarea-max-rowscustom property (number)Auto-grow bounds (3 / 12)
rowsattributeInitial height and the no-field-sizing fallback
data-counter + .field__counter[data-max]attribute / partLive counter (js/form-field.js); over the limit sets aria-invalid but never blocks typing
disabled / readonly / aria-invalid="true"attributeStates
.is-hover | .is-focus-visibledocs-only classFreezes a state

Do and don't

Do label the field with what to write and give it room for the expected answer.
Don't rely on a placeholder as the label or squeeze a long answer into one row.

Accessibility

Keyboard interaction
KeyBehavior
TabMoves focus into and out of the textarea (Tab is never captured)
EnterInserts a new line
Typing, arrows, Home EndNative text editing

Tokens

Custom propertyPurpose
--input-border, --input-bg, --input-radiusShared with text field
--size-control-mdMinimum height (2 × control)
--color-border-focus, --focus-ring-*Focus
--color-border-invalidInvalid border
--color-bg-subtle, --color-bg-muted, --color-text-disabledRead-only and disabled
--color-text-subtlePlaceholder