A structured Angular forms architecture built for complex, scalable applications.
Angular Reactive Forms tend to grow into tightly coupled components containing UI logic, reactive subscriptions, and API mapping.
ng-modular-forms introduces a separation of concerns that keeps forms scalable and maintainable.
It splits form logic into reusable building blocks:
- FormOrchestrator – form lifecycle and composition
- FormHandlerBase – reactive logic and cross-field behavior
- FormMapperBase – API ↔ UI transformations
- FormControlBase – reusable form controls (CVA-based)
Note: ng-modular-forms builds on top of Angular Reactive Forms. It does not replace them.
Start with core:
npm install @ng-modular-forms/coreAdd Material UI support if needed:
npm install @ng-modular-forms/materialFor the Material package, you'll also need:
npm install @angular/material @angular/cdkClone and run the examples app:
git clone https://github.com/ronbodnar/ng-modular-forms.git
cd ng-modular-forms
npm install
ng serveNavigate to http://localhost:4200/docs/examples to see the interactive examples.
@Component({
template: `
<form [formGroup]="form">
<nmf-text formControlName="name" label="Name" />
<nmf-currency formControlName="salary" label="Salary" />
</form>
`,
})
export class ExampleComponent {
form = new FormGroup({
name: new FormControl<string>('', Validators.required),
salary: new FormControl<number | null>(null),
});
}| Package | Description |
|---|---|
| @ng-modular-forms/core | Orchestration, handlers, mapping, hydration, serialization, controls |
| @ng-modular-forms/material | Angular Material-based input components |
All inputs share a consistent API and are interchangeable between Native and Material implementations without changing form logic.
| Input Type | Native Selector | Material Selector | Description |
|---|---|---|---|
| Text / Password | nmf-text |
nmf-mat-text |
Text / password input with toggle support |
| Number | nmf-number |
nmf-mat-number |
Type-safe numeric input |
| Currency | nmf-currency |
nmf-mat-currency |
Formatting + parsing support |
| Date | nmf-datepicker |
nmf-mat-datepicker |
Native or Material datepicker |
| Time | nmf-timepicker |
nmf-mat-timepicker |
Structured time input |
| Select | nmf-select |
nmf-mat-select |
Dropdown with option support |
| Textarea | nmf-textarea |
nmf-mat-textarea |
Multi-line input |
ControlValueAccessorcompatible- Fully compatible with Angular Reactive Forms
- Consistent API across all inputs
- Built-in validation state + error messaging
- Label, required indicator, and loading state support
- Behavior-driven input handling (formatting, parsing, restrictions)
- Angular 19–21
- Reactive Forms module
MIT