# angular14-json-form

> angular14-json-form is a library for generating angular reactive form using just a JSON

Latest version **0.0.3** (published 2023-05-31) · 0 weekly downloads

## Install

```sh
npm install angular14-json-form
pnpm add angular14-json-form
yarn add angular14-json-form
bun add angular14-json-form
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.3 |
| Published | 2023-05-31 |
| First published | 2023-05-25 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 122.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Abhishek Vishwakarma |
| Maintainers | codewithabhi |
| Keywords | angular, json, reactive, form, reactive-form, json-form, json form, form generator, library, Angular form builder, JSON form builder, Dynamic forms in Angular, Angular form generator, Form rendering in Angular, Angular JSON form library, Angular form components, Form validation in Angular, Reactive forms in Angular, Angular form controls, Angular form fields, Angular form schema, Angular form templates, JSON-based forms in Angular, Angular form rendering engine, Customizable forms in Angular, Angular form layout, Form data binding in Angular, Angular form submission, Angular form input validation |

## Links

- npm: https://www.npmjs.com/package/angular14-json-form
- Repository: https://github.com/abhigdrv/angular14-json-form
- Homepage: https://github.com/abhigdrv/angular14-json-form#readme
- Issues: https://github.com/abhigdrv/angular14-json-form/issues
- npm.io page: https://npm.io/package/angular14-json-form

## Dependencies (1)

- [tslib](https://npm.io/package/tslib.md) ^2.3.0

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 0.0.3 (latest) — 2023-05-31
- 0.0.2 — 2023-05-25
- 0.0.1 — 2023-05-25

## README

<img src="icon.png" align="right" />

# Angular14 JSON FORM [![Awesome](https://cdn.jsdelivr.net/gh/sindresorhus/awesome@d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg)](https://github.com/sindresorhus/awesome#readme)
> Generate angular reactive form from JSON with tons of dynamic properties and custom event handler
![image](https://github.com/abhigdrv/angular14-json-form/assets/52538014/c61cba48-5a33-445a-b935-943da2232200)

# Documentation
> **Installing angular14-json-form**
> npm i angular14-json-form
> 
> **Adding in your component.ts file**
> 
``` 
  title = 'libraryValidator';
  fields:any = [
    {
      name: 'name',
      type: 'text',
      label: 'Name',
      required: true,
      disabled: false,
      readonly: false,
      isVisible: true,
      defaultValue: 'John Doe',
      minLength: 3,
      minMessage: 'Name must be at least 3 characters long',
      maxLength: 20,
      maxMessage: 'Name must be at most 20 characters long',
      pattern: '^[a-zA-Z ]+$',
      patternMessage: 'Name can only contain alphabets',
      validations: {},
      validationMessages: {},
      placeholder: 'Enter Name',
      size:'',
      autofocus:'',
      filedWidth:null,
      customClass:''
    },
    {
      name: 'email',
      type: 'text',
      label: 'Email',
      required: true,
      disabled: false,
      readonly: false,
      isVisible: true,
      defaultValue: 'xyz@default.com',
      minLength: null,
      minMessage: '',
      maxLength: null,
      maxMessage: '',
      pattern: null,
      patternMessage: '',
      validations: {},
      validationMessages: {},
      placeholder: 'Enter Email',
      size:'',
      autofocus:'',
      filedWidth:null,
      customClass:''
    },
    {
      name: 'password',
      type: 'password',
      label: 'Password',
      required: true,
      disabled: false,
      readonly: false,
      isVisible: true,
      defaultValue: 'xyz@default.com',
      minLength: null,
      minMessage: '',
      maxLength: null,
      maxMessage: '',
      pattern: null,
      patternMessage: '',
      validations: {},
      validationMessages: {},
      placeholder: 'Enter Email',
      size:'',
      autofocus:'',
      filedWidth:null,
      customClass:''
    },
    {
      name: 'married',
      type: 'checkbox',
      label: 'Married',
      required: true,
      disabled: false,
      readonly: false,
      isVisible: true,
      defaultValue: 'yes',
      minLength: null,
      minMessage: '',
      maxLength: null,
      maxMessage: '',
      pattern: null,
      patternMessage: '',
      validations: {},
      validationMessages: {},
      placeholder: '',
      size:'',
      autofocus:'',
      filedWidth:null,
      customClass:'',
      options:[
        {
          label:'Married',
          value:true
        },
        {
          label:'Unmarried',
          value:false
        }
      ]
    },
    {
      name: 'gender',
      type: 'radio',
      label: 'Gender',
      required: true,
      disabled: false,
      readonly: false,
      isVisible: true,
      defaultValue: 'male',
      minLength: null,
      minMessage: '',
      maxLength: null,
      maxMessage: '',
      pattern: null,
      patternMessage: '',
      validations: {},
      validationMessages: {},
      placeholder: '',
      size:'',
      autofocus:'',
      filedWidth:null,
      customClass:'',
      options:[
        {
          label:'Male',
          value:'male'
        },
        {
          label:'Female',
          value:'female'
        }
      ]
    },
    {
      name: 'ageGroup',
      type: 'select',
      label: 'Age Group',
      required: true,
      disabled: false,
      readonly: false,
      isVisible: true,
      defaultValue: '0-10',
      minLength: null,
      minMessage: '',
      maxLength: null,
      maxMessage: '',
      pattern: null,
      patternMessage: '',
      validations: {},
      validationMessages: {},
      placeholder: '',
      size:'',
      autofocus:'',
      filedWidth:null,
      customClass:'',
      options:[
        {
          label:'0-10',
          value:'0-10'
        },
        {
          label:'10-20',
          value:'10-20'
        }
      ]
    },
    {
      name: 'bio',
      type: 'textarea',
      label: 'Bio',
      required: true,
      disabled: false,
      readonly: false,
      isVisible: true,
      defaultValue: 'I am xyz, I have done this ...',
      minLength: null,
      minMessage: '',
      maxLength: null,
      maxMessage: '',
      pattern: null,
      patternMessage: '',
      validations: {},
      validationMessages: {},
      placeholder: '',
      size:'',
      autofocus:'',
      filedWidth:null,
      customClass:''
    },
    {
      name: 'date',
      type: 'date',
      label: 'Date',
      required: true,
      disabled: false,
      readonly: false,
      isVisible: true,
      defaultValue: '03-02-2023',
      minLength: null,
      minMessage: '',
      maxLength: null,
      maxMessage: '',
      pattern: null,
      patternMessage: '',
      validations: {},
      validationMessages: {},
      placeholder: '',
      size:'',
      autofocus:'',
      filedWidth:null,
      customClass:''
    },
    {
      name: 'submit',
      type: 'submit',
      label: '',
      required: true,
      disabled: false,
      readonly: false,
      isVisible: true,
      defaultValue: '03-02-2023',
      minLength: null,
      minMessage: '',
      maxLength: null,
      maxMessage: '',
      pattern: null,
      patternMessage: '',
      validations: {},
      validationMessages: {},
      placeholder: '',
      size:'',
      autofocus:'',
      filedWidth:null,
      customClass:''
    }
  ]

  submitHandler(from:FormGroup){
    console.log(from, 'in app component')
  }
  fieldChangeHandler(val:any){
    console.log(val, 'field updated')
  }
  ```
 > **Adding in your component.html file**
 > 
 ```
  <angular14-json-form
          [title]="'Smart Form'"
          [subTitle]="'Form is build by using JSON'"
          [fields]="fields"
          [itemPerRow]="1"
          (submitHandler)="submitHandler($event)"
          (fieldChangeHandler)="fieldChangeHandler($event)"
  >
  </angular14-json-form>
  ```

---
_Source: https://npm.io/package/angular14-json-form · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
