Form Builder
Introduction
Section titled “Introduction”A form designer that produces the { schema, uiSchema } document Schema Form renders. Administrators pick field types from a palette (click, Enter, or pointer drag onto the canvas), reorder fields on the canvas by pointer drag or keyboard (Sortable List, the pattern of the dashboard builder), and edit each field in a properties panel: label, name, required, validation, options, help text, placeholder, width, and visibility conditions. A Preview tab renders the document with Schema Form, a JSON tab shows it and imports a pasted document after validating it, and every change can be undone. After each valid change the builder emits aui-change with the new document; invalid edits are rejected with a message and never reach the host.
- Palette and canvasAdd 18 field types by click, Enter, or drag; reorder fields by pointer or keyboard.
- Properties panelLabel, name, required, validation, options, help text, width, and visibility conditions.
- Live previewThe Preview tab renders the document with Schema Form, ready to submit.
- JSON in and outSee the schema and UI schema, paste a document, and import it after validation.
- Undo and redoEvery change is undoable, also with Ctrl+Z and Ctrl+Y; invalid edits never reach your app.
Use it for
- Administrators define forms (questionnaires, request types, intake forms) without a release.
- Prototyping a form and handing the JSON to developers.
Use something else for
- End users filling in forms: render them with Schema Form.
- Nested or computed form logic beyond the supported conditions: edit the JSON or write the form by hand.
Anatomy
<div class="aui-form-builder"> (size container) <div class="aui-form-builder__root"> <div class="aui-form-builder__toolbar" role="toolbar" aria-label="Leave request form">[Undo] [Redo]</div> [Tabs: Design | Preview | JSON] <div class="aui-form-builder__design"> <section class="aui-form-builder__palette"><h3>Add a field</h3><ul class="aui-form-builder__types">[Text] [Dropdown] ...</ul></section> <section class="aui-form-builder__canvas"><h3>Form fields</h3> [Sortable List: handle | <div class="aui-form-builder__item"><button class="aui-form-builder__select" aria-pressed>Label / type</button> [remove]</div>] <div class="aui-form-builder__drop" hidden></div> </section> <section class="aui-form-builder__panel"><h3>Properties: Leave type</h3><div class="aui-form-builder__fields">[controls]</div></section> </div> <div class="aui-form-builder__preview">[Schema Form] <pre class="aui-form-builder__output" role="status"></pre></div> <div class="aui-form-builder__json">[Textarea] [Apply JSON] [Revert]</div> </div></div>Live example
Section titled “Live example”Use the bar above each frame to switch theme, density, direction, and locale.
Form Builder in the Form builder showcase
Section titled “Form Builder in the Form builder showcase”The part of the Form builder showcase that uses Form Builder. Change its options, use it with the keyboard, and watch the event log; the link in the frame opens the full showcase. The bar above the frame switches theme, density, direction, and locale.
Showcase source
// Form builder showcase: an HR administrator builds a leave request form in Form Builder// (palette, canvas reordering by pointer or keyboard, properties, JSON, undo), and the published// Schema Form below renders the same document live. Submitting shows the validated JSON value; a// simulated server rejects a date with an error mapped back by JSON Pointer.import { createBusinessCalendar } from '@absoluteui/components/business-calendar';import { FormBuilder, type FormBuilderChangeDetail } from '@absoluteui/components/form-builder';import { SchemaForm, type FormSchema, type SchemaFormSubmitDetail, type UiField } from '@absoluteui/components/schema-form';import { parsePlainDate, plainDate } from '@absoluteui/core';import { action, createShowcase, hostIn, section, status, toggle } from './kit.js';
const sc = createShowcase({ title: 'Form builder', description: 'Build a leave request form: add field types from the palette, reorder them by dragging or with the keyboard, and edit their properties. The published form below follows every change.', simulated: true,});
const LEAVE: FormSchema = { type: 'object', title: 'Leave request', required: ['type', 'from', 'days'], properties: { type: { type: 'string', title: 'Leave type', oneOf: [{ const: 'annual', title: 'Annual leave' }, { const: 'sick', title: 'Sick leave' }, { const: 'other', title: 'Other' }] }, reason: { type: 'string', title: 'Reason', description: 'Tell your manager why you need the time off.', maxLength: 500 }, from: { type: 'string', title: 'First day', format: 'date' }, days: { type: 'integer', title: 'Working days', minimum: 1, maximum: 30 }, halfDay: { type: 'boolean', title: 'Start with a half day' }, cover: { type: 'string', title: 'Who covers for you?', format: 'email' }, },};const LEAVE_UI: UiField = { columns: 2, order: ['type', 'reason', 'from', 'days', 'halfDay', 'cover'], fields: { reason: { widget: 'textarea', span: 2, visibleIf: { field: 'type', equals: 'other' } }, from: { disableNonWorking: true }, halfDay: { widget: 'switch' }, cover: { placeholder: 'colleague@example.com' }, },};
// Company calendar: Monday to Friday with two public holidays (date fields skip them).const calendar = createBusinessCalendar({ workingDays: [1, 2, 3, 4, 5], holidays: [{ date: plainDate(2026, 12, 25), name: 'Christmas Day' }, { date: plainDate(2027, 1, 1), name: "New Year's Day" }] });
const builderSection = section(sc, 'Designer', ['form-builder']);const builderHost = hostIn(builderSection);const builder = FormBuilder.create(builderHost, { label: 'Leave request form', schema: LEAVE, uiSchema: LEAVE_UI });sc.listen(builderHost, ['aui-change'], 'builder');
const formSection = section(sc, 'Published form', ['schema-form', 'form-builder']);const formHost = hostIn(formSection);const form = SchemaForm.create(formHost, { schema: LEAVE, uiSchema: LEAVE_UI, businessCalendar: calendar, submitLabel: 'Request leave' });sc.listen(formHost, ['aui-change', 'aui-invalid'], 'form');const result = status(formSection);result.textContent = 'Submit the form to see its JSON value.';
let serverRejects = false;builderHost.addEventListener('aui-change', (e) => { const { schema, uiSchema } = (e as CustomEvent<FormBuilderChangeDetail>).detail; form.update({ schema, uiSchema });});formHost.addEventListener('aui-submit', (e) => { const { value } = (e as CustomEvent<SchemaFormSubmitDetail>).detail; sc.log('form aui-submit', value); const from = typeof value.from === 'string' ? parsePlainDate(value.from) : null; if (serverRejects && from) { // The simulated server answers 422 with errors by JSON Pointer. form.setErrors({ '/from': 'Your team already has two people away that week. Pick another first day.' }); result.textContent = 'The server rejected the request (see the error on First day).'; return; } result.textContent = `Submitted value: ${JSON.stringify(value)}`;});
action(sc, 'Start empty', () => { builder.setValue({ type: 'object', title: 'Leave request', properties: {} }, {}); form.update({ schema: { type: 'object', title: 'Leave request', properties: {} }, uiSchema: {}, value: {} }); sc.log('builder cleared');}, ['form-builder']);action(sc, 'Build leave request', () => { builder.setValue(LEAVE, LEAVE_UI); form.update({ schema: LEAVE, uiSchema: LEAVE_UI, value: {} }); sc.log('builder loaded the leave request');}, ['form-builder']);action(sc, 'Fill sample answers', () => { form.setValue({ type: 'annual', from: '2026-12-21', days: 4, cover: 'sam.lee@example.com' });});toggle(sc, 'Server rejects the date', false, (on) => { serverRejects = on;});toggle(sc, 'Show reset', false, (showReset) => { form.update({ showReset });});toggle(sc, 'Disabled', false, (disabled) => { form.update({ disabled });});Builder with a live Schema Form
Section titled “Builder with a live Schema Form”import { FormBuilder, type FormBuilderChangeDetail } from '@absoluteui/components/form-builder';import { SchemaForm } from '@absoluteui/components/schema-form';
const builderHost = document.createElement('div');const formHost = document.createElement('div');document.body.append(builderHost, formHost);const builder = FormBuilder.create(builderHost, { label: 'Onboarding questionnaire' });builder.addField('text');builder.addField('date');const form = SchemaForm.create(formHost, builder.getValue());builderHost.addEventListener('aui-change', (event) => { const { schema, uiSchema } = (event as CustomEvent<FormBuilderChangeDetail>).detail; form.update({ schema, uiSchema });});Edit a stored document with a reduced palette
Section titled “Edit a stored document with a reduced palette”import { FormBuilder } from '@absoluteui/components/form-builder';
const host = document.createElement('div');document.body.append(host);// Start from a stored document and offer a reduced palette.const builder = FormBuilder.create(host, { label: 'Leave request form', schema: { type: 'object', title: 'Leave request', properties: { from: { type: 'string', title: 'First day', format: 'date' } } }, fieldTypes: ['text', 'textarea', 'select', 'radio', 'date', 'integer', 'checkbox'],});builder.undo();Install and start
Section titled “Install and start”npm install @absoluteui/components @absoluteui/core @absoluteui/themeRegistry setup, the theme stylesheet, and the Content Security Policy are covered in Installation.
import { FormBuilder } from '@absoluteui/components/form-builder';import '@absoluteui/components/button/style.css';import '@absoluteui/components/tabs/style.css';import '@absoluteui/components/sortable-list/style.css';import '@absoluteui/components/inline-message/style.css';import '@absoluteui/components/text-input/style.css';import '@absoluteui/components/textarea/style.css';import '@absoluteui/components/number-input/style.css';import '@absoluteui/components/select/style.css';import '@absoluteui/components/switch/style.css';import '@absoluteui/components/form/style.css';import '@absoluteui/components/error-summary/style.css';import '@absoluteui/components/fieldset/style.css';import '@absoluteui/components/radio-group/style.css';import '@absoluteui/components/combobox/style.css';import '@absoluteui/components/multi-select/style.css';import '@absoluteui/components/checkbox/style.css';import '@absoluteui/components/checkbox-group/style.css';import '@absoluteui/components/slider/style.css';import '@absoluteui/components/rich-text-editor/style.css';import '@absoluteui/components/date-input/style.css';import '@absoluteui/components/calendar/style.css';import '@absoluteui/components/date-picker/style.css';import '@absoluteui/components/date-time-picker/style.css';import '@absoluteui/components/time-picker/style.css';import '@absoluteui/components/schema-form/style.css';import '@absoluteui/components/form-builder/style.css';First use
Section titled “First use”import { FormBuilder } from '@absoluteui/components/form-builder';import '@absoluteui/components/form-builder/style.css';
const host = document.querySelector<HTMLElement>('#designer');if (host) FormBuilder.create(host, { label: 'Survey', fieldTypes: ['text', 'radio', 'checkboxes', 'slider'] });More usage
import { FormBuilder, type FormBuilderChangeDetail } from '@absoluteui/components/form-builder';
const host = document.querySelector<HTMLElement>('#designer');if (host) { FormBuilder.create(host, { label: 'Onboarding questionnaire' }); host.addEventListener('aui-change', (event) => { const document = (event as CustomEvent<FormBuilderChangeDetail>).detail; void fetch('/api/forms/onboarding', { method: 'PUT', body: JSON.stringify(document) }); });}Using Angular? See Form Builder for Angular.
API reference
Section titled “API reference”Factory
Section titled “Factory”FormBuilder.create(host: HTMLElement, options: FormBuilderOptions): FormBuilderGlobal configuration key: formBuilder (see Configuration).
Options
Section titled “Options”| Option | Type | Default | Description |
|---|---|---|---|
label |
string |
Accessible name of the builder (toolbar). Required. | |
schema |
FormSchema |
Initial schema (root type object). Default: an empty form. | |
uiSchema |
UiField |
Initial UI schema. | |
fieldTypes |
readonly FormBuilderFieldType[] |
Field types offered in the palette, in order. Default: all 18. | |
icons |
Partial<FormBuilderIcons> |
Icon overrides: undo, redo, remove, handle. | |
historyLimit |
number |
"100" |
Undo steps kept (1 to 1000). Globally configurable. |
locale |
string |
"en-US" |
Locale of the builder’s messages and controls. Globally configurable. Inherited from common configuration. |
Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
host |
HTMLElement |
The host element. |
options |
Readonly<FormBuilderOptions> |
Current options. |
selected |
string | null |
Selected field name, or null (form settings). |
canUndo |
boolean |
Whether there is a step to undo. |
canRedo |
boolean |
Whether there is a step to redo. |
Methods
Section titled “Methods”| Method | Description |
|---|---|
getValue(): FormBuilderChangeDetail |
The current { schema, uiSchema } (a copy). |
setValue(schema: FormSchema, uiSchema?: UiField): void |
Replace the document (validated, undoable, no event). |
addField(type: FormBuilderFieldType, index?: number): string |
Add a field after the selection or at index; returns its name. |
removeField(name: string): void |
Remove a field and the conditions that use it. |
selectField(name: string | null): void |
Select a field, or null for the form settings. |
undo(): void | redo(): void |
Step through the history (also Ctrl+Z, Ctrl+Y, Ctrl+Shift+Z outside text fields). |
update(options: Partial<FormBuilderOptions>): void |
Merge options; a new schema or uiSchema replaces the document and clears the history. |
destroy(): void |
Destroy every control and empty the host. |
Events
Section titled “Events”| Event | Detail | Bubbles | Cancelable | Description |
|---|---|---|---|---|
aui-change |
FormBuilderChangeDetail |
Yes | No | The document changed (edit, reorder, import, undo, redo): { schema, uiSchema }, always valid for Schema Form. |
CSS classes
Section titled “CSS classes”All rules live in the aui.components cascade layer, so application styles override them without specificity battles.
| Class | Purpose |
|---|---|
aui-form-builder |
Host (a size container). |
aui-form-builder__toolbar |
Undo and redo (role=toolbar). |
aui-form-builder__design |
Palette, canvas, and properties. |
aui-form-builder__palette | __types | __type |
Field type list and its buttons. |
aui-form-builder__canvas | __drop |
Field list (Sortable List) and the drop line while dragging a type. |
aui-form-builder__item | __item--selected | __select |
A field on the canvas, the selected one, and its select button. |
aui-form-builder__panel | __fields |
Properties panel and its controls. |
aui-form-builder__preview | __output |
Schema Form preview and the submitted value. |
aui-form-builder__json |
JSON view. |
Icon slots
Section titled “Icon slots”| Slot | Default icon |
|---|---|
undo |
undo |
redo |
redo |
remove |
trash |
handle |
menu |
Design tokens
Section titled “Design tokens”Tokens this stylesheet reads (verified in CI). Override them in a theme or with the Theme Designer.
--aui-border-width | --aui-color-border | --aui-color-focus-ring | --aui-color-hover | --aui-color-primary | --aui-color-selected | --aui-color-selected-text | --aui-color-surface | --aui-color-surface-sunken | --aui-color-text | --aui-color-text-muted | --aui-focus-ring-offset | --aui-focus-ring-width | --aui-font-family-mono | --aui-font-family-sans | --aui-font-size-md | --aui-font-size-sm | --aui-font-weight-medium | --aui-font-weight-semibold | --aui-line-height-normal | --aui-radius-md | --aui-radius-sm | --aui-space-1 | --aui-space-2 | --aui-space-3 | --aui-space-4
TypeScript definitions
type FormBuilderFieldType = 'text' | 'textarea' | 'richtext' | 'email' | 'url' | 'number' | 'integer' | 'slider' | 'select' | 'radio' | 'combobox' | 'multiselect' | 'checkboxes' | 'checkbox' | 'switch' | 'date' | 'datetime' | 'time';interface FormBuilderConfig { historyLimit: number }interface FormBuilderIcons { undo: IconRef; redo: IconRef; remove: IconRef; handle: IconRef }interface FormBuilderOptions extends Partial<FormBuilderConfig> { label: string; schema?: FormSchema; uiSchema?: UiField; fieldTypes?: readonly FormBuilderFieldType[]; locale?: string; icons?: Partial<FormBuilderIcons>;}interface FormBuilderChangeDetail { schema: FormSchema; uiSchema: UiField }Accessibility and performance
Section titled “Accessibility and performance”Accessibility
Section titled “Accessibility”Pattern: Toolbar plus Tabs (Design, Preview, JSON); the canvas is a Sortable List (keyboard grab, move, drop with announcements); the palette and properties are labelled regions of native buttons and AbsoluteUI form controls.
Checked on every docs build: the showcase passes axe (WCAG 2.2 A and AA rules) in the default, dark, and high-contrast themes and right to left; the playground loads without errors and passes axe before and after every on/off option is switched, with no Content Security Policy violations.
Keyboard
Section titled “Keyboard”| Key | Context | Action |
|---|---|---|
| Enter / Space | Palette button | Add the field type after the selected field and select it. |
| Enter / Space | Field select button | Select the field and move focus to its properties. |
| Delete | Field select button | Remove the field. |
| Space / Enter, arrows, Space / Enter, Escape | Canvas handle | Grab, move, drop, or cancel (Sortable List). |
| Ctrl+Z / Ctrl+Y / Ctrl+Shift+Z | Builder (outside text fields) | Undo and redo. |
| Arrow keys | Tabs | Switch between Design, Preview, and JSON. |
| Element | Role |
|---|---|
| toolbar | toolbar (named by label) |
| views | tablist / tab / tabpanel (Tabs) |
| palette, canvas, properties | region (section with a heading) |
| canvas list | list (Sortable List) |
| field select button | button with aria-pressed |
| preview output | status |
ARIA attributes
Section titled “ARIA attributes”| Attribute | Element | Value |
|---|---|---|
aria-pressed |
field select button | true for the selected field |
aria-label |
field select button | ‘Leave type, Dropdown, required’ |
aria-label |
remove button | ‘Remove Leave type’ |
aria-labelledby |
regions | their headings |
Removing a field focuses the next field’s select button (or the first palette button); undo and redo keep focus where it is.
WCAG 2.2 success criteria addressed
Section titled “WCAG 2.2 success criteria addressed”| Criterion | Level | Note |
|---|---|---|
| 1.3.1 Info and Relationships | A | |
| 2.1.1 Keyboard | A | |
| 2.4.3 Focus Order | A | |
| 2.4.6 Headings and Labels | AA | |
| 2.5.7 Dragging Movements | AA | |
| 3.3.1 Error Identification | A | |
| 4.1.2 Name, Role, Value | A | |
| 4.1.3 Status Messages | AA |
Automated test results: Accessibility and compliance.
Notes and known caveats
Section titled “Notes and known caveats”- Every pointer drag (palette to canvas, canvas reordering) has a keyboard equivalent (WCAG 2.5.7).
- Additions, removals, moves, undo, and redo are announced through the polite live region; rejected edits are shown in an assertive Inline Message.
- Manual screen-reader verification (NVDA, JAWS, VoiceOver) is pending.
Performance
Section titled “Performance”| Import cost | Minified | gzip | brotli | CSS brotli |
|---|---|---|---|---|
@absoluteui/components/form-builder |
369.8 kB | 106.5 kB | 85.9 kB | 0.9 kB |
Measured at build time, including every AbsoluteUI module the component pulls in. No third-party runtime dependencies.
| Budget (enforced in CI) | Limit |
|---|---|
| FormBuilder.create with 50 fields | < 120 ms average in headless Chromium |
Tested scale: Up to 200 fields on the canvas; 100 undo steps stored as JSON Patches.
Each change re-renders the canvas rows in place (stable rows per field) and, when visible, updates the preview and JSON. History steps are JSON Patches, so 100 steps stay small.
Measured run times: Performance.
Details
Section titled “Details”States
Empty canvas, a field selected, form settings (nothing selected), dragging a field type over the canvas, keyboard reordering, edit rejected (assertive message), Preview, JSON view with an invalid import, undo and redo available or not.
State transitions
| From | Trigger | To |
|---|---|---|
| any | palette button (click, Enter, Space) | field added after the selection and selected; announced; aui-change |
| any | palette drag released over the canvas | field inserted at the drop line; aui-change |
| field selected | property committed (blur, Enter, selection) | document updated; aui-change |
| field selected | an edit that makes the document invalid | edit rejected; message in the panel; no event |
| any | reorder (drag or keyboard) | new order; aui-change |
| JSON view | Apply JSON with a valid document | document replaced; aui-change |
| any | Undo / Redo / Ctrl+Z / Ctrl+Y | previous / next document; announced; aui-change |
Accessibility notes
- Every pointer drag has a keyboard path (WCAG 2.5.7): palette buttons add without dragging; handles reorder by keyboard.
- Additions, removals, moves, undo, and redo are announced politely.
- Headings start at level 3; place the builder under a level-2 heading.
- The e2e axe run covers three themes; manual screen-reader verification is pending.
Responsive behavior
The three panes sit side by side at 56rem or more (container query) and stack below; tabs keep Preview and JSON one tap away on phones.
Right-to-left
Logical properties throughout; panes and handles mirror.
Theming
The selected field is marked by color and a border; forced colors use Highlight and HighlightText.
Global configuration
configureAbsoluteUI({ components: { formBuilder: { historyLimit: 200 } } });Component configuration
Instance historyLimit and locale override configuration.
Timezones
Not applicable to the builder. Date fields it creates behave as in Schema Form; the “Only working days” switch sets disableNonWorking (it takes effect when the Schema Form has a businessCalendar).
Icons
icons.undo (undo), icons.redo (redo), icons.remove (trash), icons.handle (Sortable List menu). Palette entries use icons of the AbsoluteUI icon set.
Security
Labels, options, and help text are rendered as text. Imported JSON is parsed with safeJsonParse (1 MB) and validated with checkFormSchema and checkUiSchema before it is applied. Conditions are data; nothing is evaluated as code.
Data handling
No persistence, network access, or telemetry: store the emitted document yourself.
Supported data scale
Up to 200 fields on the canvas.
Edge cases
- Renaming a field updates
required, the order, its UI entry, and conditions that refer to it; a taken or invalid name is refused. - Removing a field also removes conditions that depend on it.
- An option list or minimum/maximum that makes the schema invalid is refused with the issue list.
- Imported nested groups and lists stay intact; their inner fields are edited in the JSON view.
- Undo after a JSON import restores the previous document.
Errors
| Code | Category | Cause |
|---|---|---|
FORM_BUILDER_OPTIONS |
configuration | Blank label, unknown field types, or an initial schema or UI schema Schema Form does not support. |
FORM_BUILDER_VALUE |
configuration | setValue() with an invalid document (the message lists the pointers). |
FORM_BUILDER_TYPE |
configuration | addField() with an unknown type. |
CFG_INVALID_VALUE / CFG_UNKNOWN_OPTION |
configuration | Invalid or unknown configuration. |
Known limitations
- The builder edits top-level fields; nested groups and lists are edited in the JSON view.
- The visibility editor writes one condition per field; combined conditions are kept and edited as JSON.
- Manual screen-reader verification is pending.
Unsupported scenarios
- Custom field types in the palette.
- Collaborative editing.
(c) 2026 Kasadara Technology Solutions Pvt Ltd. AbsoluteUI is free to use under the AbsoluteUI Free Use License; it is not open source.