๐Ÿ“‹ ngx-better-forms

January 26, 2026 ยท View on GitHub

Better, cleaner, and more maintainable reactive form utilities for Angular.

status Build npm version License


๐Ÿš€ Features

  • ๐Ÿงฉ Conditional validators for complex reactive forms
  • โšก Utility methods to simplify control management
  • ๐Ÿงช >95% unit tested

๐Ÿ“˜ Documentation

https://bioroxx.github.io/ngx-better-forms

๐Ÿ“ฆ Installation

npm install @ngx-better-forms/better-forms

๐Ÿ’ก Example Usage

See short examples below.

You can find a full feature showcase in the documentation.

Conditional Validators

Add validators to a target FormControl, based on the current value of another FormControl.

formGroup = this.formBuilder.group(
  {
    field1: new FormControl<string>(''),
    target: new FormControl<string>(''),
  },
  {
    validators: [
      BetterValidation.conditionalValidators({
        targetControlPath: 'target',
        targetValidators: [Validators.required],
        conditions: [
          {
            controlPath: 'field1',
            testValues: ['a', 'b'],
          },
        ],
      }),
    ],
  },
);

Conditional Disable

formGroup = this.formBuilder.group(
  {
    field1: new FormControl<string>(''),
    target: new FormControl<string>(''),
  },
  {
    validators: [
      BetterDisable.conditionalDisable({
        targetControlPath: 'target',
        conditions: [
          {
            controlPath: 'field1',
            testValues: ['a', 'b'],
          },
        ],
      }),
    ],
  },
);

โš ๏ธ Disclaimer:
This library is currently in very early development.
Features, APIs, and behavior may change without notice โ€” use with caution, but be inspired. โœจ