1. vue-formly
A simple and extendable form builder for Vue.js
vue-formly
Package: vue-formly
Created by: formly-js
Last modified: Tue, 28 Jun 2022 19:31:49 GMT
Version: 2.5.9
License: MIT
Downloads: 300
Repository: https://github.com/formly-js/vue-formly

Install

npm install vue-formly
yarn add vue-formly

Vue Formly

Vue Formly is a JS based form builder heavily inspired by Angular Formly. Vue Formly was designed to provide an easy way to keep your forms consistent and to remove bloat from your code. As there's no "one way" to design your forms, Vue Formly allows you to create custom input types which you can use in your form schemas. Vue Formly itself does not come with any inputs pre-loaded but a set of Boostrap form inputs can be installed over at Vue Formly Bootstrap.

NOTE
This is version 2 of Vue Formly and is only compatible with Vue 2.x. If you are wanting to use this with Vue 1.x then check out the Vue Formly 1 Branch.

Installation

npm install vue-formly

Or via a script

 <script src="your_dir/vue-formly/vue-formly.min.js"></script>

Usage

Take a look at the docs for extended information about using Formly and creating custom input types. But here is a quick example:
NOTE that for Vue Formly to work correctly you must also include a set of input types. You can either create your own or check out Vue Formly Bootstrap which has many already created for you.

 <div id="app">
   <form @submit="handleSubmission">
      <formly-form :form="form" :model="model" :fields="fields"></formly-form>
      <button>Submit</button>
   </form>
</div>
 new Vue({
   el: '#app',
   data: {
      model: {
         name: '',
         email: '',
         password: ''
      },
      form: {},
      fields: [
         {
            key: 'name',
            type: 'input',
            required: true
         },
         {
            key: 'email',
            type: 'input',
            templateOptions: {
               type: 'email'
            },
            required: true,
            validators: {
               validEmail: checkEmailFunction
            }
         },
         {
            key: 'password',
            type: 'input',
            templateOptions: {
               type: 'password'
            },
            required: true,
            validators: {
               validPassword: checkPasswordFunction
            }
         }
      ]
   }
});

Dependencies

RELATED POST

10 Must-Know Windows Shortcuts That Will Save You Time

10 Must-Know Windows Shortcuts That Will Save You Time

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Navigating AWS Networking: Essential Hacks for Smooth Operation

Navigating AWS Networking: Essential Hacks for Smooth Operation

Achieving Stunning Visuals with Unity's Global Illumination

Achieving Stunning Visuals with Unity's Global Illumination

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code