Skip to content

Text Input for Angular

import { AuiTextInput } from '@absoluteui/angular/text-input';

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

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

import { Component } from '@angular/core';
import { FormControl, ReactiveFormsModule, Validators } from '@angular/forms';
import { AuiTextInput } from '@absoluteui/angular/text-input';
@Component({
selector: 'app-profile',
imports: [ReactiveFormsModule, AuiTextInput],
template: `<aui-text-input label="Email" type="email" [required]="true" [formControl]="email"></aui-text-input>`,
})
export class ProfileComponent {
readonly email = new FormControl('', { nonNullable: true, validators: [Validators.required] });
}

Class AuiTextInput; template reference #ref="auiTextInput".

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.
type TextInputType 'text' Native input type. email and url add type validation.
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 input.
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).
pattern string HTML pattern semantics (anchored, v flag).
showCounter boolean false Show remaining/over characters; requires maxLength.
autocomplete string Native autocomplete token. Password default: current-password.
inputMode "none" | "text" | "search" | "numeric" | "email" | "url" | "tel" | "decimal" Virtual keyboard hint.
spellcheck boolean Default true for type text, false otherwise.
prefix string Text addon at the inline start.
suffix string Text addon at the inline end.
revealable boolean true Password inputs: show a reveal/hide toggle button.
clipboard ClipboardPolicy 'allow' Clipboard policy for sensitive values.
validate (value: string) => string | null Consumer validation; return a message to mark the value invalid.
icons Partial<TextInputIcons> 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) TextInputValueDetail User edited the value. Re-emits aui-input.
(changed) TextInputValueDetail User committed the value (native change). 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 input.
reset(): void Restore the initial value and clear dirty/touched/submitted state.

AuiTextInputHarness from @absoluteui/angular/testing. <aui-text-input>.