formanitor
v0.0.5
Published
Formanitor is a powerful, schema-driven dynamic form library for React. It is designed to separate core logic (validation, rules, workflow) from the UI layer, enabling you to build complex, role-based forms with ease.
Downloads
592
Readme
Formanitor
Formanitor is a powerful, schema-driven dynamic form library for React. It is designed to separate core logic (validation, rules, workflow) from the UI layer, enabling you to build complex, role-based forms with ease.
🚀 Key Features
- Schema-Driven: Define your entire form (layout, fields, validation) in a single JSON object.
- Headless Core: Logic is decoupled from the UI, powered by a custom observable store.
- Workflow Engine: Built-in state machine for managing form lifecycles (e.g., Draft -> In Progress -> Finalised).
- Rule Engine: simple JSON-based rules for field visibility, disabling, and requirement toggling.
- Role-Based Access: Granular permissions (view/edit/hide) per field based on user roles.
- Async Data: Support for loading dropdown options from API endpoints.
- Persistence: Pluggable adapters for LocalStorage, SessionStorage, IndexedDB, or API.
- Event System: Emit signals (e.g.,
HIGH_PAIN_ALERT) based on field changes.
🛠 Tech Stack
- React 19 + Vite
- TypeScript
- Tailwind CSS
- shadcn/ui (Radix UI) components
📦 Project Structure
src/
├── core/ # Pure TS Logic (Store, Rules, Validation)
├── react/ # React Bindings (Hooks, Context, Renderer)
├── ui/ # UI Components (Layouts, Widgets)
│ ├── shadcn/ # Base accessible components
│ └── widgets/ # Form-specific widgets (Text, Select, Repeatable)
└── App.tsx # Demo Application🏃♂️ Getting Started
Install Dependencies:
npm installRun Development Server:
npm run devExplore the Demo: Open the app to see the OBG Intake Form in action. You can:
- Switch roles (Patient, Nurse, Doctor) to see permissions change.
- Enter "Age < 18" to see the Rule Engine hide the "Pain Score" field.
- Select "Pain Score > 7" to trigger a
HIGH_PAIN_ALERTevent. - Transition the workflow state from Draft to Finalised.
📝 Example Schema
{
"id": "demo-form",
"layout": [{ "type": "section", "title": "Info", "children": ["name"] }],
"fields": {
"name": { "type": "text", "label": "Full Name", "required": true }
}
}📄 License
MIT
