Skip to content

mprinc/angular-material-formio

 
 

Repository files navigation

Dynamic JSON Powered forms for Angular Material

This library introduces the powerful Form.io JSON forms into the Angular Material framework.

Installation

To install this library into your application, you will need to run the following.

npm install angular-material-formio

Then, you will need to add the following to your codebase.

src/app/app.module.ts

import { MatFormioModule } from 'angular-material-formio';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    BrowserAnimationsModule,
    MatFormioModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

Using this library

This library can be used to render dynamic JSON powered forms within any Angular Material application. This uses the exact same syntax as the <formio> component within the Angular Form.io Library. The only difference is that you will use the <mat-formio> directive instead.

For example, the following will render a dynamic JSON form within your application.

<mat-formio src="https://examples.form.io/kitchensink"></mat-formio>

You can also use this to render JSON forms as follows.

<mat-formio [form]="{
  components: [
    {
      type: 'textfield',
      label: 'First Name',
      key: 'firstName'
    },
    {
      type: 'textfield',
      label: 'Last Name',
      key: 'lastName'
    },
    {
      type: 'button',
      action: 'submit',
      label: 'Submit',
      key: 'submit'
    }
  ]
}" (submit)="onSubmit($event)"></mat-formio>

About

JSON powered forms for Angular Material

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 98.4%
  • JavaScript 1.2%
  • CSS 0.4%