Angular form builder
A form builder for Angular, open source all the way down.
The builder your users edit forms in, the component that draws them and the server that checks what comes back — all Apache-2.0. Zoneless, signals and OnPush: written for Angular rather than wrapped for it.
Try it
This is the Angular starter, built as it is in the repository: the builder on the left, the form it builds on the right, drawn with Angular Material. Change a label, add a field, then press Save — it opens on your form next time.
Install
npm install @formancy/angular @formancy/builder-angular @formancy/builder-core @formancy/coreThen a component with the builder in it. myForm is a form document — JSON, which the starter’s expense-claim.ts is an example of:
import { Component, signal } from '@angular/core'
import { FormancyBuilder, FormancyPropertyPanel } from '@formancy/builder-angular'
import { createBuilderSession } from '@formancy/builder-core'
import { myForm } from './my-form'
@Component({
selector: 'app-editor',
imports: [FormancyBuilder, FormancyPropertyPanel],
template: `
<formancy-builder [session]="session" (selected)="selected.set($event)" />
@if (selected(); as keyPath) {
<formancy-property-panel [session]="session" [keyPath]="keyPath" />
}
`,
})
export class Editor {
protected readonly session = createBuilderSession(myForm)
protected readonly selected = signal<readonly string[] | null>(null)
}The form it builds is drawn by @formancy/angular — with its own unstyled controls, with yours, or with Angular Material. The Angular guide has both halves.
Save it, open it again
A form is a JSON document, so saving one is writing session.document() wherever you keep things, and opening it is createBuilderSession(saved). Check it first: a session refuses an invalid document by throwing. This is the starter’s saved-form.ts, the file the demo above runs — in the browser’s storage, and yours to point at a server.
import type { FormSchema } from '@formancy/spec'
import { validateSchema } from '@formancy/spec/validate'
/**
* Where this app keeps the form somebody built: the browser's own storage, under a key that
* says whose it is. A form is JSON, so keeping one is writing a string and opening one is
* reading it back; replace these three functions with requests to your own server — or to a
* formancy server, which versions what it is given — and nothing else changes.
*
* Every access is guarded: a private window, or a browser told to keep nothing, throws on
* the first touch of `localStorage`, and that should cost the visitor saving, not the app.
*/
const KEY = 'formancy-starter:form'
/** The saved form, if there is one this version can still open. */
export function savedForm(): FormSchema | undefined {
try {
const text = localStorage.getItem(KEY)
if (text === null) return undefined
const document: unknown = JSON.parse(text)
// Checked before it is opened: a session refuses an invalid document by throwing, and an
// app that cannot start because of something it saved itself is worse than one that
// starts on its default.
return validateSchema(document).valid ? (document as FormSchema) : undefined
} catch {
return undefined
}
}
/** Keep `document`; false when this browser keeps nothing for the page. */
export function saveForm(document: FormSchema): boolean {
try {
localStorage.setItem(KEY, JSON.stringify(document))
return true
} catch {
return false
}
}Tested on
- Angular 22.0.0 and the newest 22, with Angular Material at the same version
- React 19.0.0 and the newest 19, for the same form drawn by
@formancy/react - Node.js 22.12.0 and 24, for the server
Each is a CI run on every pull request. For Angular, that is the packed packages installed into an Angular project at that version, built by it and run in Chromium. Angular server-side rendering and browsers other than Chromium are not run. What each run proves.