romanslonov / form-wrapper-js

JS abstraction for forms

Home Page:https://nevoss.github.io/form-wrapper-js/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Form Wrapper JS

Form wrapper js

npm MIT codecov CircleCI

A lightweight library that creates forms systems in a convenient and easy way, without dependencies and magic code.

🎨 Playground

πŸ’Ώ Installation

npm install --save form-wrapper-js

or

yarn add form-wrapper-js

πŸ“– Documentation

Please check out the Form Wrapper JS website.

πŸš€ Basic Usage

This is a quick example, please check out the website for full documentation.

<template>
  <form @submit.prevent="submit">
    <input type="text" v-model="form.email" />
    <input type="text" v-model="form.name" />
    <input type="text" v-model="form.password" />

    <button type="submit" :disabled="form.$submitting">
  </form>
</template>

<script>
import { Form } from 'form-wrapper-js'
import axios from 'axios'

export default {
  data() {
    return {
      form: new Form({
        email: null,
        name: null,
        password: null,
      }),
    }
  },
  methods: {
    async submit() {
      const { response } = await this.form.$submit(form => axios.post('some-url', form.$values()))
    }
  },
}
</script>

🍻 Contribute

Code, Docs, Bug reports, Ideas - are more the welcome. ⭐

the installation is very easy, take a look at CONTRIBUTING.md file and follow the instructions.

πŸ”’ License

The MIT License (MIT). Please see License File for more information.

About

JS abstraction for forms

https://nevoss.github.io/form-wrapper-js/

License:MIT License


Languages

Language:TypeScript 99.2%Language:JavaScript 0.8%