npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@linkiez/primeng-dynamic-form

v1.1.2

Published

Angular 22 + PrimeNG 22 dynamic form library

Readme

@linkiez/primeng-dynamic-form

Angular 22 + PrimeNG 22 library for schema-driven dynamic forms.

Installation

npm install @linkiez/primeng-dynamic-form

Peer dependencies (must be installed in your project):

  • @angular/common ^22.1.0
  • @angular/core ^22.1.0
  • @angular/forms ^22.1.0
  • primeng ^22.1.1

Quick Start

import { Component } from '@angular/core';
import { DynamicFormComponent, FormSchema, FormSubmissionPayload } from '@linkiez/primeng-dynamic-form';

@Component({
  selector: 'app-example',
  standalone: true,
  imports: [DynamicFormComponent],
  template: `
    <pdf-dynamic-form
      [schema]="schema"
      (formSubmit)="onSubmit($event)"
    />
  `,
})
export class ExampleComponent {
  protected schema: FormSchema = {
    schemaVersion: '1.0',
    formId: 'user-profile',
    fields: [
      { key: 'name', type: 'text', label: 'Nome', validators: [{ name: 'required' }] },
      { key: 'email', type: 'email', label: 'Email', validators: [{ name: 'email' }] },
    ],
  };

  protected onSubmit(payload: FormSubmissionPayload): void {
    if (!payload.valid) {
      console.error('Formulário inválido', payload.errors);
      return;
    }
    console.log('Dados válidos', payload.values);
  }
}

Supported Field Types

| Type | PrimeNG Component | |------------|--------------------| | text | pInputText | | email | pInputText | | password | p-password | | number | p-inputnumber | | textarea | pTextarea | | select | p-select | | autocomplete | p-autocomplete | | cascadeselect | p-cascadeselect | | checkbox | p-checkbox | | radio | p-radiobutton | | multiselect | p-multiselect | | listbox | p-listbox | | selectbutton | p-selectbutton | | togglebutton | p-togglebutton | | toggleswitch | p-toggleswitch | | colorpicker | p-colorpicker | | inputmask | p-inputmask | | inputotp | p-inputotp | | inputtags | p-inputtags | | editor | pTextarea (fallback textual; o Editor do PrimeNG OSS está deprecated) | | date | p-datepicker | | date-range | p-datepicker (range mode) | | slider | p-slider | | knob | p-knob | | rating | p-rating | | treeselect | p-treeselect | | file | p-fileupload | | custom | fallback renderer (pInputText) |

Validation

PrimeNG Component Configuration

Every field accepts componentProps. Supported component inputs are forwarded through explicit bindings in the renderer; pBind also applies compatible host attributes such as class, style, and custom DOM attributes.

fields: [
  {
    key: 'status',
    type: 'select',
    label: 'Status',
    options: [
      { label: 'Ativo', value: 'active' },
      { label: 'Inativo', value: 'inactive' },
    ],
    componentProps: {
      filter: true,
      showClear: true,
      variant: 'filled',
      panelStyle: { maxHeight: '20rem' },
    },
  },
  {
    key: 'birthday',
    type: 'date',
    label: 'Nascimento',
    componentProps: {
      showIcon: true,
      showButtonBar: true,
      dateFormat: 'dd/mm/yy',
      view: 'month',
    },
  },
  {
    key: 'score',
    type: 'slider',
    label: 'Pontuação',
    componentProps: { min: 0, max: 100, step: 5 },
  },
  {
    key: 'phone',
    type: 'inputmask',
    label: 'Telefone',
    componentProps: { mask: '(99) 99999-9999', slotChar: '_' },
  },
],

The renderer maps the documented properties above to the corresponding PrimeNG inputs. Other host attributes can also be supplied through componentProps; unsupported component inputs require a renderer mapping before they can affect a PrimeNG InputSignal.

Declare synchronous validators in the schema. Supported validators (v1):

| Name | Description | Params | |--------------|----------------------------------------|------------------------------| | required | Field must have a value | — | | email | Must be a valid email format | — | | minLength | Minimum string length | { min: number } | | maxLength | Maximum string length | { max: number } | | min | Minimum numeric value | { min: number } | | max | Maximum numeric value | { max: number } | | pattern | Regex pattern match | { pattern: string \| RegExp } | | customSync | Custom synchronous validator function | { fn: ValidatorFn } |

Example

fields: [
  {
    key: 'username',
    type: 'text',
    label: 'Usuário',
    validators: [
      { name: 'required' },
      { name: 'minLength', params: { min: 3 }, message: 'Mínimo 3 caracteres.' },
      { name: 'maxLength', params: { max: 20 } },
      { name: 'pattern', params: { pattern: '^[a-zA-Z0-9_]+$' }, message: 'Somente letras, números e _' },
    ],
  },
],

Configuration

The optional [config] input allows customizing behavior and layout:

import { DynamicFormConfiguration } from '@linkiez/primeng-dynamic-form';

config: DynamicFormConfiguration = {
  showSubmitButton: true,    // default: true
  submitLabel: 'Enviar',     // default: 'Enviar'
  showResetButton: true,     // default: false
  resetLabel: 'Limpar',      // default: 'Limpar'
  emitOnChange: true,        // default: false — emit formChange on each value change
  layoutMode: 'horizontal',  // default: 'vertical' | 'horizontal' | 'grid'
  locale: 'en-US',
  fallbackLocale: 'pt-BR',
  translations: {
    'pt-BR': {
      'form.submitLabel': 'Enviar',
      'form.resetLabel': 'Limpar',
      'fields.name.label': 'Nome',
    },
    'en-US': {
      'form.submitLabel': 'Submit',
      'form.resetLabel': 'Reset',
      'fields.name.label': 'Name',
    },
  },
};

Template

<pdf-dynamic-form
  [schema]="schema"
  [config]="config"
  [initialValues]="{ name: 'Padrão' }"
  (formSubmit)="onSubmit($event)"
  (formChange)="onValueChange($event)"
  (beforeSubmit)="onBeforeSubmit($event)"
  (afterReset)="onAfterReset($event)"
/>

API Reference

DynamicFormComponent

Selector: pdf-dynamic-form

| Input | Type | Required | Description | |-----------------|----------------------------|----------|-------------------------------------------| | schema | FormSchema | ✅ | Declarative form schema | | config | DynamicFormConfiguration | ❌ | Behavioral and layout configuration | | initialValues | Record<string, unknown> | ❌ | Pre-populated field values |

| Output | Type | Description | |--------------|--------------------------------------------|----------------------------------------------------| | formSubmit | EventEmitter<FormSubmissionPayload> | Emitted on valid form submission | | formChange | EventEmitter<Record<string, unknown>> | Emitted on each value change (if emitOnChange=true) | | beforeSubmit | EventEmitter<Record<string, unknown>> | Emitted right before payload generation on valid submit | | afterReset | EventEmitter<Record<string, unknown>> | Emitted right after form reset |

FormSubmissionPayload

interface FormSubmissionPayload {
  valid: boolean;
  values: Record<string, unknown>;
  errors: Record<string, string[]>;  // field key → array of error messages
}

Versioning and Migration

  • This package follows Semantic Versioning.
  • Breaking changes to the public API require a major version bump.
  • Schema changes (e.g., new schemaVersion) are documented with migration notes in CHANGELOG.md.
  • Compatibility is limited to Angular 22 + PrimeNG 22.

v1 Limitations

  • Only Angular 22 + PrimeNG 22 officially supported.
  • Only synchronous validators (async validation is out of v1 scope).
  • Supported field types are listed in the table above.
  • schemaVersion must be "1.0".

Publish Checklist

Before publishing a new version to NPM:

  1. Tests — all suites must pass:

    npm run test:all
  2. Lint — zero errors:

    npm run lint
  3. Bump version — update packages/dynamic-form/package.json following SemVer:

    • patch for bug fixes
    • minor for new backward-compatible features
    • major for breaking API changes
  4. Build — compile the library:

    npm run build
  5. Dry-run — verify package contents from the dist/ folder:

    cd dist/@linkiez/primeng-dynamic-form
    npm pack --dry-run
  6. Publish:

    npm publish --access public
  7. Tag the release:

git tag v1.0.x git push origin v1.0.x