Skip to content

Textarea for Angular

AngularForm Inputs

Multi-line text entry built on a native <textarea>, with label, required indicator, help text, localized constraint validation, optional character counter, and optional auto-grow sizing.

  • Multi-line entryA native textarea with label, required marker, help text, and validation message.
  • Grows with contentAuto resize expands the field as text is added, up to an optional row limit.
  • Length limitsMinimum and maximum length with an optional live character counter.
  • Shared validationLocalized messages from the same engine as every other AbsoluteUI field.

Behavior, design tokens, and limitations are described on the Textarea page; this page covers the Angular API.

import { Component } from '@angular/core';
import { FormControl, ReactiveFormsModule, Validators } from '@angular/forms';
import { AuiTextarea } from '@absoluteui/angular/textarea';
@Component({
selector: 'app-feedback',
imports: [ReactiveFormsModule, AuiTextarea],
template: `<aui-textarea label="Feedback" [rows]="4" resize="auto" [maxRows]="10" [maxLength]="1000" [showCounter]="true" [formControl]="feedback"></aui-textarea>`,
})
export class FeedbackComponent {
readonly feedback = new FormControl('', { nonNullable: true, validators: [Validators.required] });
}
Terminal window
npm install @absoluteui/angular @absoluteui/components @absoluteui/core @absoluteui/theme

Setup with provideAbsoluteUI() is covered in Getting started. Styles are included with the component.

import { AuiTextarea } from '@absoluteui/angular/textarea';

Defaults for every instance: provideAbsoluteUIConfig({ components: { textarea: { ... } } }) (see Configuration).

Class AuiTextarea; template reference #ref="auiTextarea".

Server rendering: Renders on the server; the browser re-creates it after hydration.

Angular forms: implements ControlValueAccessor and Validator; the form value is string. Bind [formControl], formControlName, or [(ngModel)]; validation messages of the component report through the aui error key. See Forms.

Input Type Default Description
label string Required. Visible label and accessible name.
hideLabel boolean false Visually hide the label; it remains the accessible name.
name string Form field name.
placeholder string Supplementary hint; never replaces the label.
description string Help text referenced by aria-describedby.
required boolean false Empty value is invalid; shows the required indicator.
disabled boolean false Disables the textarea.
readOnly boolean false Value is focusable and submitted but not editable.
minLength number Minimum length in code points.
maxLength number Maximum length in code points (validated, not truncated).
showCounter boolean false Show remaining/over characters; requires maxLength.
rows number '3' Visible text rows, integer 1..100; the minimum height for resize ‘auto’.
resize TextareaResize 'vertical' Native vertical resize handle, fixed height, or grow with content.
maxRows number Upper bound in rows for resize ‘auto’ (integer >= rows); content scrolls beyond it.
autocomplete string Native autocomplete token.
spellcheck boolean true Native spellcheck.
validate (value: string) => string | null Consumer validation; return a message to mark the value invalid.
icons Partial<TextareaIcons> Icon slot overrides.
validationTiming ValidationTiming 'blur' When validation messages first appear; afterwards they update live.
locale string 'en-US' Message and number-formatting locale.
Model Type Change output Description
[(value)] string (valueChange) The value: [(value)] without forms; with Angular forms, bind the form control instead.
Output Payload Description
(valueInput) TextareaValueDetail User edited the value. Re-emits aui-input.
(changed) TextareaValueDetail User committed the value (native change, on blur). Re-emits aui-change.

Call them through a viewChild query or a template reference.

Method Description
reportValidity(): boolean | undefined Show messages now and return validity.
setCustomError(message: string | null): void External error (server, cross-field rule); cleared when the user edits.
getFormValue(): string | undefined Value for form serialization.
focus(): void Focus the textarea.
reset(): void Restore the initial value and clear dirty/touched/submitted state.

AuiTextareaHarness from @absoluteui/angular/testing. <aui-textarea>.

Pattern: Native <textarea> with a <label for> association (HTML).

The Angular component renders the framework-neutral component, so its keyboard support, roles, WCAG 2.2 criteria, budgets, and import cost apply unchanged: see Textarea: Accessibility and performance.