@ng-forge/dynamic-forms-primeng
TypeScript icon, indicating that this package has built-in type declarations

0.9.0 • Public • Published

ng-forge Dynamic Forms

@ng-forge/dynamic-forms-primeng

PrimeNG field components for @ng-forge/dynamic-forms.

CI npm version npm downloads Angular License: MIT Discord

Experimental API Notice: This library uses Angular's experimental Signal Forms API. Angular may introduce breaking changes in patch releases. Check the compatibility matrix below.

Compatibility

@ng-forge/dynamic-forms-primeng @ng-forge/dynamic-forms Angular
0.9.x 0.9.x >=21.2.0
0.8.x 0.8.x >=21.2.0
0.7.x 0.7.x >=21.2.0
0.6.x 0.6.x >=21.1.0
0.5.x 0.5.x >=21.1.0
0.4.x 0.4.x >=21.1.0
0.3.x 0.3.x 21.0.7-21.0.x
0.2.x 0.2.x 21.0.6
0.1.1+ 0.1.1+ 21.0.2-21.0.5
0.1.0 0.1.0 21.0.0-21.0.1

Installation

npm install @ng-forge/dynamic-forms @ng-forge/dynamic-forms-primeng primeng @primeng/themes primeicons

Setup

// app.config.ts
import { providePrimeNG } from 'primeng/config';
import Aura from '@primeng/themes/aura';
import { provideDynamicForm } from '@ng-forge/dynamic-forms';
import { withPrimeNGFields } from '@ng-forge/dynamic-forms-primeng';

export const appConfig: ApplicationConfig = {
  providers: [
    providePrimeNG({
      theme: {
        preset: Aura,
      },
    }),
    provideDynamicForm(...withPrimeNGFields()),
  ],
};
// styles.scss
@import 'primeicons/primeicons.css';

Usage

import { DynamicForm, type FormConfig, type InferFormValue } from '@ng-forge/dynamic-forms';

@Component({
  imports: [DynamicForm],
  template: `<form [dynamic-form]="config" (submitted)="onSubmit($event)"></form>`,
})
export class ContactFormComponent {
  config = {
    fields: [
      { key: 'email', type: 'input', value: '', label: 'Email', required: true, email: true },
      { type: 'submit', key: 'submit', label: 'Submit', props: { severity: 'primary' } },
    ],
  } as const satisfies FormConfig;

  onSubmit(value: InferFormValue<typeof this.config.fields>) {
    console.log('Form submitted:', value);
  }
}

Global Configuration

provideDynamicForm(
  ...withPrimeNGFields({
    variant: 'filled',
    size: 'large',
    severity: 'primary',
  }),
);

Field Types

Input, Textarea, Select, Checkbox, Toggle, Radio, Multi-Checkbox, Datepicker, Slider, Button, Submit, Next, Previous

Addons

prime-input ships first-class prefix / suffix addon slots accepting the PrimeNG-specific prime-icon / prime-button kinds plus the universal text / template / component kinds. withPrimeNGFields() auto-registers them — no extra setup needed.

See Addons / Overview, Presets and Actions, and Custom Kinds for the full surface (slots, kinds, presets, actionRef, reactive hidden / disabled, custom kind registration).

Documentation

Changelog

See GitHub Releases.

Contributing

Contributions are welcome! Please read our Contributing Guide.

License

MIT © ng-forge