Skip to content

Text Input for Angular

AngularForm Inputs

Single-line text entry built on a native <input>, with label, required indicator, help text, localized constraint validation, optional character counter, text addons, and sensitive-input support (password reveal, clipboard policy).

  • Typed text entryText, email, URL, phone, search, and password types with matching keyboards and autocomplete.
  • Shared validationRequired, length, pattern, and custom checks with localized messages identical in every browser.
  • Counter and addonsAn optional character counter plus prefix and suffix text such as units or domains.
  • Password helpersA reveal toggle and a clipboard policy that can block copying or pasting.
  • Message timingShow validation on blur, on input, or only on submit.

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

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] });
}
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 { AuiTextInput } from '@absoluteui/angular/text-input';

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

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" | "numeric" | "tel" | "decimal" | "search" | "email" | "url" 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>.

Pattern: Native <input> 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 Text Input: Accessibility and performance.