Convert Figma logo to code with AI

wearebraid logovue-formulate

⚡️ The easiest way to build forms with Vue.

2,254
242
2,254
128

Top Related Projects

4,272

Vue Forms ⚡️ Supercharged

Simple, lightweight model-based validation for Vue.js

✅ Painless Vue forms

Quick Overview

Vue Formulate is a comprehensive form building and validation library for Vue.js. It aims to simplify the process of creating complex forms by providing a declarative syntax and powerful validation features. Vue Formulate is designed to be flexible, customizable, and easy to use.

Pros

  • Intuitive and declarative syntax for building forms
  • Built-in validation with a wide range of predefined rules
  • Highly customizable with support for custom inputs and validation rules
  • Excellent documentation and examples

Cons

  • Learning curve for more advanced features and customizations
  • May be overkill for simple forms or projects with minimal form requirements
  • Limited built-in support for complex multi-step forms
  • Dependency on Vue.js ecosystem

Code Examples

  1. Basic form with validation:
<template>
  <FormulateForm @submit="handleSubmit">
    <FormulateInput
      type="text"
      name="username"
      label="Username"
      validation="required|min:3"
    />
    <FormulateInput
      type="email"
      name="email"
      label="Email"
      validation="required|email"
    />
    <FormulateInput
      type="submit"
      label="Submit"
    />
  </FormulateForm>
</template>

<script>
export default {
  methods: {
    handleSubmit(data) {
      console.log(data)
    }
  }
}
</script>
  1. Custom input component:
<template>
  <FormulateInput
    type="custom-rating"
    v-model="rating"
    :options="[1, 2, 3, 4, 5]"
  />
</template>

<script>
import { FormulateInput } from '@braid/vue-formulate'

export default {
  components: { FormulateInput },
  data() {
    return {
      rating: 0
    }
  }
}
</script>
  1. Group validation:
<template>
  <FormulateForm>
    <FormulateInput
      type="group"
      name="address"
      :validation="[['street', 'city', 'zipcode'], 'required']"
    >
      <FormulateInput name="street" label="Street" />
      <FormulateInput name="city" label="City" />
      <FormulateInput name="zipcode" label="Zip Code" />
    </FormulateInput>
  </FormulateForm>
</template>

Getting Started

  1. Install Vue Formulate:
npm install @braid/vue-formulate
  1. Import and use in your Vue.js application:
import Vue from 'vue'
import VueFormulate from '@braid/vue-formulate'

Vue.use(VueFormulate)
  1. Start using Vue Formulate components in your templates:
<template>
  <FormulateForm>
    <FormulateInput
      type="text"
      name="name"
      label="Name"
      validation="required"
    />
    <FormulateInput
      type="submit"
      label="Submit"
    />
  </FormulateForm>
</template>

Competitor Comparisons

4,272

Vue Forms ⚡️ Supercharged

Pros of FormKit

  • More comprehensive documentation and examples
  • Active development with frequent updates and bug fixes
  • Built-in support for advanced features like repeatable fields and conditional logic

Cons of FormKit

  • Steeper learning curve due to more complex API
  • Larger bundle size, which may impact performance in smaller projects
  • Some users report occasional issues with TypeScript support

Code Comparison

Vue Formulate:

<FormulateForm>
  <FormulateInput
    type="text"
    name="username"
    label="Username"
    validation="required"
  />
</FormulateForm>

FormKit:

<FormKit
  type="form"
  :actions="false"
  @submit="handleSubmit"
>
  <FormKit
    type="text"
    name="username"
    label="Username"
    validation="required"
  />
</FormKit>

Both libraries offer similar syntax for basic form creation, but FormKit provides more flexibility and options for complex scenarios. Vue Formulate has a simpler API, which can be advantageous for smaller projects or developers new to form libraries. FormKit's additional features and active development make it a strong choice for larger, more complex applications, despite the potential drawbacks of increased complexity and bundle size.

Simple, lightweight model-based validation for Vue.js

Pros of Vuelidate

  • Lightweight and flexible, with a smaller bundle size
  • Supports model-based validation, allowing for more complex validation scenarios
  • Offers easy integration with existing Vue projects

Cons of Vuelidate

  • Requires more manual setup and configuration
  • Less intuitive for beginners due to its flexibility and lower-level API
  • Lacks built-in form generation capabilities

Code Comparison

Vue-formulate:

<FormulateForm>
  <FormulateInput
    type="text"
    name="username"
    label="Username"
    validation="required|min:3"
  />
</FormulateForm>

Vuelidate:

<template>
  <input v-model="$v.username.$model" />
</template>

<script>
import { required, minLength } from 'vuelidate/lib/validators'

export default {
  validations: {
    username: { required, minLength: minLength(3) }
  }
}
</script>

Vue-formulate provides a more declarative approach with built-in form components, while Vuelidate offers a programmatic way to define validations, giving developers more control over the validation process and integration with custom form elements.

✅ Painless Vue forms

Pros of VeeValidate

  • More flexible and customizable validation rules
  • Better support for complex form scenarios and dynamic validation
  • Extensive documentation and community support

Cons of VeeValidate

  • Steeper learning curve for beginners
  • Requires more setup and configuration compared to Vue Formulate

Code Comparison

VeeValidate:

<template>
  <Form @submit="onSubmit">
    <Field name="email" v-slot="{ field, errors }">
      <input v-bind="field" type="email">
      <span>{{ errors[0] }}</span>
    </Field>
    <button>Submit</button>
  </Form>
</template>

Vue Formulate:

<template>
  <FormulateForm @submit="onSubmit">
    <FormulateInput
      type="email"
      name="email"
      validation="required|email"
    />
    <FormulateInput type="submit" label="Submit" />
  </FormulateForm>
</template>

VeeValidate offers more granular control over field rendering and error display, while Vue Formulate provides a more concise and opinionated approach. VeeValidate's flexibility allows for easier integration with existing form structures, but Vue Formulate's simplicity can lead to faster development for straightforward forms.

Both libraries have their strengths, and the choice between them depends on the specific requirements of your project and your team's preferences.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

VueFormulate

npm GitHub

Documentation Website

🚀 Looking for Vue 3 support? Checkout FormKit — the best way to build forms with Vue 3.

What is Vue Formulate?

Vue Formulate is the easiest way to build forms with Vue. Please read the comprehensive documentation for live code examples and guidance on using Vue Formulate in your own projects.

Key features

😎 Developer happiness

Forms are everywhere, yet surprisingly tedious to author — well, not anymore. Vue Formulate provides a powerful and flexible API to developers that makes complex form creation a breeze.

☝️ A single input element

With Vue Formulate you don't need to remember the names of a dozen components — all form elements are created with a single component. Easy!

💪 Grouped fields

Vue Formulate ships with repeatable field groups out of the box. Create complex UIs such as multi-person booking forms with ease.

🎯 Built-in validation

Ridiculously easy validation out-of-the-box to handle 95% of use-cases. Help text, validation rules, and validation messages are simple props. Need more? You can add custom validations too.

🔌 Plugin system

Extend Vue Formulate's functionality or reuse custom inputs, validation rules, and messages across projects by tapping into the plugin system. Make your plugin open source to share with others!

✨ Generate forms

Generate an entire form from JSON. Vue Formulate includes a schema to allow you to render complex forms from JSON with groups, wrappers, and custom components.

🎨 Styling Control

With provided class props you can add your own set of style classes globally or on a case-by-case basis. Tailwind? No problem. Bootstrap? You're covered. Roll your own? Right on, it’s supported.

🔍 Scoped Slots

Need even more control over your form’s markup? Vue Formulate ships with full scoped slots support so that you can globally or selectively provide your own markup.

🌐 Internationalization

Thanks to the wonderfully collaborative Vue community, Vue Formulate ships with support for over a dozen languages which are selectively importable to keep bundle size light.

These features and many more are covered thoroughly at the documentation website.

Contributing

Vue Formulate is and always will be free and open source. There are many ways available for you to contribute to Vue Formulate.

Core Codebase Contributors

This project exists thanks to all the people who volunteer their time to contribute

Localization Contributors

Vue Formulate is translated into different languages by volunteer native language speakers. Localizations are located in the Vue Formulate Internationalization repo.

License

MIT

Copyright (c) 2020-present, Braid LLC

NPM DownloadsLast 30 Days