declarative-forms

await an object the way prompt() awaits a string

Last checked:

Visit declarative-forms

What is declarative-forms?

A JavaScript form library that provides a function-based API to prompt users for structured data objects, similar to browser's prompt() but for complex multi-field forms. Call ask() from anywhere in your code, the dialog renders itself, and you get the object back—no component mounting, state management, or mount point required.

declarative-forms pricing

Pricing model: Freemium

declarative-forms pros

  • Simple function-based API—call ask() and await the result from anywhere in code
  • Supports rich field types: text, textarea, select, datetime, arrays, computed fields, cards, and conditional visibility
  • Zero form state management overhead—the library handles all state internally
  • Nested dialogs and complex workflows with button actions and field interdependencies
  • Async-friendly—options functions can load dynamically when fields depend on other values

declarative-forms cons

  • Limited to browser environments with dialog/DOM support
  • Young/niche library with potentially smaller community and ecosystem than established form libraries
  • No explicit mention of maintenance status, versioning, or long-term support

Frequently asked questions about declarative-forms

How is this different from other form libraries?

Most form libraries provide a component to mount in your React tree. Declarative-forms gives you a function to call—ask() returns a promise that resolves to your structured object, with no mounting or state management needed.

Can I load options dynamically?

Yes, option functions can be async and are recalculated whenever their dependencies change. For example, a 'reviewers' select can reload its list when the 'team' field changes.

Can I create nested or stacked dialogs?

Yes, you can open new dialogs from button actions or field handlers, creating stacked dialogs that appear on top of each other with full data access to parent dialogs.

Do I need to manage form state manually?

No, the library handles all field state, validation, and synchronization internally. You only receive the final object when the user confirms.

Categories

Use cases

Browse all AI tools on NeedAnAI