1.2.1 • Published 8 months ago

@yyasinaslan/dynamic-form v1.2.1

Weekly downloads
-
License
MIT
Repository
-
Last release
8 months ago

Dynamic Form for Angular 15 + Bootstrap 5

Downloads

This component library helps you to generate form template with configuration objects.

Demo Site | Npm Package | Github

Advanced usage and detailed documentation will be added soon...

Installation

Install package with npm or yarn

yarn add @yyasinaslan/dynamic-form
#or
npm install @yyasinaslan/dynamic-form

In your angular.json or style.scss include this library styles

angular.json

{
  ...
  "styles": [
    "node_modules/@yyasinaslan/dynamic-form/styles/dynamic-form.css"
  ]
  ...
}

style.scss

@import "node_modules/@yyasinaslan/dynamic-form/styles/dynamic-form.scss";

Import DynamicFormModule to your module or standalone component

import {DynamicFormModule} from "@yyasinaslan/dynamic-form";

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    DynamicFormModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})

That's it.

Be careful this package is still under development.

Basic usage

Define your inputs in app component, or anywhere you want like below.

export class AppComponent {

  inputs = [
    new TextBoxInput({
      key: 'firstName',
      value: '',
      label: 'Firstname',
      validators: [Validators.required],
      validatorsMessage: [{key: 'required', message: 'Firstname required'}]
    }),
    new TextBoxInput({
      key: 'lastName',
      value: '',
      label: 'Lastname',
      validators: [Validators.required],
      validatorsMessage: [{key: 'required', message: 'Lastname required'}]
    }),
  ]

  formSubmitHandler(event: FormGroup) {
    // You can get form value with event object
  }
}

In app.component.html you can use dynamic form like this

<ngy-dynamic-form
  [inputs]="inputs"
  (post)="formSubmitHandler($event)"
  formName="userForm"></ngy-dynamic-form>

This will generate form with automatic layout (Bootstrap grid used)

npm.io

1.2.0

9 months ago

1.1.8

9 months ago

1.1.7

9 months ago

1.2.1

8 months ago

1.1.6

11 months ago

1.1.5

12 months ago

1.1.4

1 year ago

1.1.3

1 year ago

1.1.2

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago