Skip to content

Prompt Input for Angular

AngularForm Inputs

The composer of a chat or assistant: an auto-growing text field where Enter sends and Shift+Enter adds a line (or Ctrl/Cmd+Enter sends), attachments by button, paste, or drop with type, size, and count limits, a character or token counter hook, a Send button that becomes Stop while a reply streams, and an optional suggestions popup for slash commands or mentions. A form control with label, help text, and validation.

  • Enter to sendEnter sends and Shift+Enter adds a line, or switch to Ctrl/Cmd+Enter; IME composition never sends by accident.
  • Grows with the textThe field grows from one row up to maxRows, then scrolls, without layout jumps.
  • AttachmentsAttach by button, paste, or drop, with type, size, and count limits, removable chips, and announcements.
  • Send becomes StopWhile a reply streams, the Send button turns into Stop and the field stays editable for the next message.
  • Commands and mentionsTrigger characters such as / and @ open a keyboard-driven suggestions list from your own data.
  • A real form controlLabel, help text, validation, a character or token counter hook, and Form integration like every other field.

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

import { Component } from '@angular/core';
import { FormControl, ReactiveFormsModule } from '@angular/forms';
import { AuiPromptInput } from '@absoluteui/angular/prompt-input';
@Component({
selector: 'app-composer',
imports: [AuiPromptInput, ReactiveFormsModule],
template: `<aui-prompt-input label="Message" [attachments]="true" [formControl]="message" (sent)="send()"></aui-prompt-input>`,
})
export class ComposerComponent {
readonly message = new FormControl('', { nonNullable: true });
send(): void {
this.message.setValue('');
}
}
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 { AuiPromptInput } from '@absoluteui/angular/prompt-input';

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

Class AuiPromptInput; template reference #ref="auiPromptInput".

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. Label and accessible name of the text field.
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 text (without attachments) is invalid.
disabled boolean false Disables the field and its buttons.
status PromptInputStatus 'idle' Reply state: sending locks the field and shows a spinner; streaming turns Send into Stop.
rows number '1' Visible rows when empty (integer 1..40).
maxRows number '8' The field grows up to this many rows, then scrolls (integer >= rows).
maxLength number Limit in counter units (characters, or the units of count); validated, not truncated.
showCounter boolean false Show the counter; requires maxLength.
count (value: string) => number Counter hook, for example a tokenizer; returns the size of the text in its own units.
counterUnit "tokens" | "characters" Unit in the counter text; default characters, or tokens when count is set.
attachments boolean false Show the attach button and accept pasted or dropped files.
accept readonly string[] '[]' Accepted MIME types (image/*) or extensions (.pdf); empty accepts any.
maxFiles number '10' Most files attached at once (integer 1..100).
maxFileSize number | null null Largest file in bytes, or null for no limit.
triggers readonly PromptTrigger[] Suggestions popups for trigger characters: { char, suggest(query) } (slash commands, mentions).
showHint boolean false Show the keyboard hint (how to send and add a line) under the field.
icons Partial<PromptInputIcons> Icon slot overrides (send, stop, attach, remove, file, error).
submitKey PromptSubmitKey 'enter' Enter sends (Shift+Enter adds a line), or Ctrl/Cmd+Enter sends (Enter adds a line).
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) PromptInputValueDetail User edited the text: { value, validity }. Re-emits aui-input.
(changed) PromptInputValueDetail User committed the text (native change, on blur). Re-emits aui-change.
(sent) PromptInputSendDetail User sent: { text, attachments }; prevent it to keep the text and files in the field. Re-emits aui-send.
(stopped) {} User pressed Stop while status is streaming. Re-emits aui-stop.
(attachmentsChange) PromptInputAttachmentChangeDetail Files were attached or removed by the user: { attachments, rejected }. Re-emits aui-attachment-change.
(suggestionSelected) PromptInputSuggestionSelectDetail A suggestion was inserted: { trigger, suggestion }. Re-emits aui-suggestion-select.

Call them through a viewChild query or a template reference.

Method Description
send(): boolean | undefined Send like the Send button: emits the cancelable aui-send and clears the field unless prevented; false when nothing was sent.
setAttachments(files: readonly File[]): void Replace the attached files (no events; limits are not applied).
addFiles(files: readonly File[]): PromptInputRejectedFile[] | undefined Add files as if the user picked them: limits apply, aui-attachment-change is emitted; returns the refused files.
openFilePicker(): void Open the file chooser (attachments must be enabled).
clear(): void Clear the text and the attachments (no events).
reportValidity(): boolean | undefined Show messages now and return validity.
setCustomError(message: string | null): void External error; cleared when the user edits.
getFormValue(): string | undefined Value for form serialization (the text).
focus(): void Focus the text field.
reset(): void Restore the initial text, remove attachments, and clear dirty/touched/submitted state.

Pattern: Native <textarea> with a <label for> association (HTML); suggestions follow the APG listbox with aria-activedescendant on the text field.

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