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-formsDescription
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
📊 Global score
🤖 AI-enriched data
Gratuit, licence MIT, aucun coût.
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)