A form is a function you call, not a component you mount
declarative-forms is a JavaScript form library that asks the user for an object the way prompt() asks for a string. Instead of mounting a component, you call a function and get a plain JavaScript object back. The dialog draws itself, loads its own options, keeps every field in sync, and resolves where you asked.
It solves the one flaw of prompt(): the browser's built-in API only asks for exactly one string. declarative-forms keeps that obvious ask-and-answer shape and removes the limit — you describe the record you want (fields, options, tabs, validation) and receive a plain object in return.
It is for developers building applications that need to collect structured data from users without wiring up form components, form state, or mount points. It is zero-dependency and framework agnostic, works anywhere in your code, and supports async options, cross-field reactivity, tabs, and stacked dialogs.
There is no component, form state, or mount point. You ask a question from anywhere in your code and the answer arrives where you asked, as a plain object.
Any options function may be async, so option lists can be fetched from an API at dialog-open time and reload automatically when another field changes.
Fields can activate or deactivate based on other values (isActive), reload when a dependency changes (reloadOnChangeOf), and recalculate hidden derived fields before any button action runs.
Fields are grouped with a tab property. The tab bar builds itself and automatically hides any tab when none of its fields is active.
A dialog can open another dialog on top of it, layering multiple modals (e.g. a Schedule dialog opening from a release dialog, with a third on top).
Includes text, textarea, select (single and multiple), checkbox, message, file, computed, cards, custom, and array fields to describe a wide variety of inputs.
Array fields let users add records with custom rendering and per-entry validation, and can be seeded with suggested entries.
Buttons run arbitrary actions against the collected values, such as applying values to other fields and triggering an update of the form.
No. It is described as zero dependencies and framework agnostic.
You call a function (or build a DeclarativeForm and open it) that returns a promise resolving to a plain object of the collected values. There is no component to mount and no place in your component tree where the form has to live.
Yes. Any options function may be async, and options lists can reload when another field changes while ignoring out-of-date answers.
Yes. A tab property groups fields, and the tab bar builds itself, hiding any tab whose fields are all inactive.
Yes. A dialog can open another dialog on top of it, and multiple dialogs can stack, with the values of every open dialog available via stackData.
The library includes text, textarea, select (single and multiple), checkbox, message, file, computed, cards, custom, and array field kinds.