Skip to content

Schema Form for Angular

AngularForms

Renders a complete form from a JSON Schema subset (draft 2020-12 keywords) and an optional UI schema, with the existing AbsoluteUI controls inside a native form managed by Form. Controls are named by JSON Pointer, so values validate, serialize, and show the Error Summary exactly like a hand-written form; getValue() returns typed JSON, aui-submit carries the validated value, and server errors map back with setErrors(pointer -> message). Unsupported keywords are configuration errors, never silently ignored.

  • JSON Schema in, form outDraft 2020-12 keywords: types, required, enums, ranges, lengths, patterns, formats, arrays, and nested objects.
  • Real AbsoluteUI controlsFields are Text Input, Select, Date Picker, and friends inside Form, so validation and the Error Summary work as usual.
  • UI schemaWidgets, order, columns, help text, placeholders, and safe JSON visibility conditions without eval.
  • Arrays with the keyboardAdd, remove, and reorder entries with buttons; every change is announced.
  • Typed JSON and pointersgetValue() returns typed JSON; server errors map back with setErrors by JSON Pointer.
  • Strict by designUnsupported keywords are configuration errors with their pointers, never silently ignored.

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

import { Component } from '@angular/core';
import type { FormSchema, SchemaFormSubmitDetail } from '@absoluteui/components/schema-form';
import { AuiSchemaForm } from '@absoluteui/angular/schema-form';
@Component({
selector: 'app-leave-request',
imports: [AuiSchemaForm],
template: `<aui-schema-form [schema]="schema" submitLabel="Request leave" (submitted)="save($event)"></aui-schema-form>`,
})
export class LeaveRequestComponent {
readonly schema: FormSchema = { type: 'object', title: 'Leave request', required: ['from'], properties: { from: { type: 'string', title: 'First day', format: 'date' } } };
save(detail: SchemaFormSubmitDetail): void {
console.log(detail.value);
}
}
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 { AuiSchemaForm } from '@absoluteui/angular/schema-form';

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

Class AuiSchemaForm; template reference #ref="auiSchemaForm".

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

Input Type Default Description
schema FormSchema Required. JSON Schema subset (root type object); unsupported keywords throw a configuration error listing each pointer.
uiSchema UiField Presentation: widget, label, help, placeholder, order, columns, span, visibleIf, rows, orientation, disableNonWorking, addLabel, patternMessage; children under fields, array items under items.
value JsonObject Initial value; values that do not match the schema type are ignored. reset() returns to it.
label string Accessible name of the form. Default: the schema title.
submitLabel string Submit button text. Default: localized Submit.
showReset boolean false Also show a reset button.
disabled boolean false Disable every field and the actions.
businessCalendar BusinessCalendarEngine | null null Working days and holidays for the date pickers; disableNonWorking in the UI schema uses it.
timezone string IANA time zone of date-time fields. Default: the global configuration.
validate (value: JsonObject, signal: AbortSignal) => Promise<Readonly<Record<string, string>>> Async validation after the constraint checks pass; return messages by JSON Pointer.
showActions boolean true Show the submit (and optional reset) buttons.
locale string 'en-US' Locale of messages and of the rendered controls.
Output Payload Description
(changed) SchemaFormChangeDetail Any edit, including array add, remove, and move: { value, pointer }. Control events do not leave the form. Re-emits aui-change.
(submitted) SchemaFormSubmitDetail Valid submission: { value } (typed JSON). Re-emits aui-submit.
(invalidSubmit) SchemaFormInvalidDetail Submission blocked: { errors: [{ pointer, label, message }] }. Re-emits aui-invalid.

Call them through a viewChild query or a template reference.

Method Description
getValue(): JsonObject | undefined The current value as JSON; hidden and empty optional fields are left out.
submit(): void Submit through the native pipeline.
reset(): void Restore the initial value and clear messages.
setErrors(errors: Readonly<Record<string, string>>): void Show errors by JSON Pointer on fields, groups, or the summary.
clearErrors(): void Remove every message.
focusField(pointer: string): boolean | undefined Move focus to the field at a pointer; false when it is not visible.

Pattern: Native form with labelled AbsoluteUI controls (each follows its own APG pattern), Fieldset groups for objects and arrays, and the GOV.UK-style Error Summary from Form.

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