DF

declarative-forms

Ask the user for an object, the way prompt() asks for a string.

free Web Developer Tools

declarative-forms is a developer tools tool. It's best for JavaScript developers and Web application developers. Pricing is free.

Pricing

free

Audience

JavaScript developers

Platforms

Community

0%

About declarative-forms

declarative-forms is a JavaScript library that provides a function-based API for creating dynamic forms, allowing developers to define form fields as an object and receive a plain object back, without requiring component mounting or managing form state.

declarative-forms offers a unique approach to form creation by providing a function to call, rather than a component to mount. This means there is no form state to manage, no mount point, and no specific place in the application's component tree where the form needs to reside. Developers can invoke the form from any part of their code, and the resulting data is returned directly to the call site.

The library is designed to be framework-agnostic and has zero dependencies, making it highly flexible for integration into various JavaScript projects. It supports advanced features such as asynchronous options for fields, cross-field reactivity, tabbed interfaces, and stacked dialogs, allowing for complex and interactive user input experiences.

Inspired by the browser's native `prompt()` function, declarative-forms extends this simple 'ask and receive' model to handle structured data. Instead of just a string, developers describe the desired record structure, and the library handles the rendering of the dialog, loading of options, synchronization of fields, and resolution of the form data into a plain JavaScript object.

Key Features

Function-based API for form creation
Zero dependencies
Framework agnostic
Asynchronous field options
Cross-field reactivity
Tabbed form interfaces
Stacked dialogs/modals
Automatic dialog rendering
Plain object data return
Custom field kinds
Array fields with suggestions
Theming tokens for appearance customization
Text and HTML safety
Accessibility features

Pricing

free

declarative-forms is an open-source library, implying it is free to use.

Who is it for?

Best for

  • Developers needing to quickly gather structured data from users without complex UI frameworks
  • Projects requiring dynamic and interactive forms with advanced features like async options and reactivity
  • Applications where form logic needs to be decoupled from UI components

Not ideal for

  • Users looking for a visual drag-and-drop form builder
  • Projects that require server-side form validation out-of-the-box
  • Non-developers

Community Discussion

Sign in to contribute

No discussions yet. Be the first to share your experience!

Frequently asked questions