Skip to content

Textarea for Angular

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

Styles are included with the component. Behavior, keyboard and screen-reader support, design tokens, and limitations are described on the Textarea page; this page covers the Angular API.

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

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] });
}

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>.