declarative-forms

declarative-forms

A JavaScript library that asks users for structured data through a modal dialog with a single function call, like calling prompt() but for full forms.

🔗 Visit declarative-forms
📁 Web Development & Frameworks🗣️ English📅 September 5, 2026

Description

Building a settings dialog or an admin panel usually means wiring up form state, validation, and a component tree just to ask the user for a few fields. declarative-forms skips that: you call one function, describe the fields you want (text, select, checkbox, file, computed fields, arrays), and `await` a promise that resolves with the user's answer — much like the browser's built-in `prompt()`, but for structured, multi-field data instead of a single string.

It's framework-agnostic (works with React, Vue, Svelte, Angular, or vanilla JS) because it renders through plain DOM and web components rather than plugging into any particular framework's component model, and it ships with zero runtime dependencies. It handles validation gating, field synchronization, and dialog lifecycle for you, supports reactive field options (show/hide fields based on other answers), and even lets you stack dialogs where an inner dialog can read values from the outer one. It's MIT-licensed, tested with Playwright and Vitest, and still small — about 3 GitHub stars and clearly early-stage.

💬 Our review

The short version: declarative-forms solves a real annoyance — the ceremony of building one-off forms for internal tools — with a genuinely different API shape than React Hook Form or Formik, but it's early enough that you're adopting a pattern, not a mature ecosystem.

Against React Hook Form or Formik, which assume you're building forms as part of your component tree, declarative-forms is closer to a modal-based "ask and wait" utility — a better fit specifically for admin panels, config flows, and internal tooling where a form is a one-off interruption rather than a page. That specialization is also its limit: it's not meant for marketing signup pages or heavily custom-styled forms, has no built-in validation schema (you write your own checks), and its accessibility story (focus traps, ARIA) is admittedly incomplete. Worth it if you're building internal tools or admin UIs across multiple frameworks and want to stop rewriting the same modal-form boilerplate; skip it for public-facing marketing forms, or if you need a mature, batteries-included validation system out of the box.

💰 Pricing

Open sourceFree, MIT license
Self-hosted Free (MIT license)

📊 Global score

45Average
🌐Availability15/100Faible

1 language · 0 platform

📄Profile75/100Bien

Profile completeness

🤖 AI-enriched data

💰 Pricing model
💳 Open source

Gratuit, licence MIT, aucun coût.

👥 Target audienceDéveloppeurs construisant des panneaux d'administration, outils internes, écrans de configuration
🗣️ Languagesen
🌍 Target countriesInternational
👍

Pros

Aucun couplage à un arbre de composants ni boilerplate de state management

API simple basée sur les promesses

Agnostique du framework (React, Vue, Svelte, Angular, vanilla JS)

Zéro dépendance runtime, bundle minimal

👎

Cons

Mise en page fixe en dialogue modal, inadapté aux formulaires marketing sur-mesure

Aucun système de validation par schéma intégré

Accessibilité (focus trap, ARIA) encore incomplète

Projet très jeune, adoption minimale (3 étoiles GitHub)

❓ Frequently asked questions

What is declarative-forms in one sentence?
Which frameworks does it support?
Does it handle validation?
Can dialogs be nested?
Is it production-ready?
Is it worth the money compared to alternatives?
Which tool should you pick for your case?