Convert Figma logo to code with AI

xaboy logoform-create

:fire::fire::fire: 强大的低代码动态表单组件,通过JSON数据驱动表单渲染,适配移动端,支持可视化设计。提高开发者对表单的开发效率。目前在政务系统、OA系统、ERP系统、电商系统、流程管理等系统中已稳定应用。

6,061
975
6,061
28

Top Related Projects

4,272

Vue Forms ⚡️ Supercharged

33,863

Build forms in React, without the tears 😭

4,460

Performance-focused API for React forms 🚀

📋 React Hooks for form state management and validation (Web + React Native)

Simple, lightweight model-based validation for Vue.js

Quick Overview

Form-create is a powerful and flexible form generation library for Vue.js. It allows developers to quickly create complex forms using JSON schemas, supporting various form components and layouts. The library aims to simplify form creation and management in Vue applications.

Pros

  • Easy to use with a declarative approach using JSON schemas
  • Supports a wide range of form components and layouts
  • Highly customizable with support for custom components and rules
  • Integrates well with popular UI frameworks like Element UI and iView

Cons

  • Learning curve for complex form configurations
  • Documentation could be more comprehensive, especially for advanced use cases
  • Limited built-in validation options, may require additional plugins for complex validations
  • Performance might be affected for extremely large and complex forms

Code Examples

  1. Basic form creation:
import FormCreate from '@form-create/element-ui'

const form = FormCreate({
  el: '#app',
  rule: [
    { type: 'input', field: 'name', title: 'Name' },
    { type: 'input', field: 'email', title: 'Email' },
    { type: 'datePicker', field: 'birthday', title: 'Birthday' }
  ]
})
  1. Adding validation rules:
const rule = [
  {
    type: 'input',
    field: 'username',
    title: 'Username',
    validate: [
      { required: true, message: 'Username is required' },
      { min: 3, max: 20, message: 'Length should be 3-20 characters' }
    ]
  }
]
  1. Creating a dynamic form:
import { maker } from '@form-create/element-ui'

const dynamicForm = FormCreate({
  el: '#app',
  rule: [
    maker.input('name', 'Name'),
    maker.select('gender', 'Gender').options([
      { value: 'male', label: 'Male' },
      { value: 'female', label: 'Female' }
    ]),
    maker.switch('newsletter', 'Subscribe to newsletter')
  ]
})

Getting Started

To use form-create in your Vue.js project:

  1. Install the package:

    npm install @form-create/element-ui
    
  2. Import and use in your Vue component:

    import FormCreate from '@form-create/element-ui'
    import Vue from 'vue'
    
    Vue.use(FormCreate)
    
    export default {
      data() {
        return {
          formRule: [
            { type: 'input', field: 'name', title: 'Name' },
            { type: 'input', field: 'email', title: 'Email' }
          ]
        }
      },
      template: '<form-create :rule="formRule"></form-create>'
    }
    

This setup provides a basic form with name and email fields using Element UI components.

Competitor Comparisons

4,272

Vue Forms ⚡️ Supercharged

Pros of FormKit

  • More comprehensive documentation and examples
  • Built-in validation and error handling system
  • Supports multiple UI frameworks (Vue, React, Svelte)

Cons of FormKit

  • Steeper learning curve due to its more complex architecture
  • Larger bundle size, which may impact performance for smaller projects

Code Comparison

form-create:

formCreate([
  {
    type: 'input',
    field: 'name',
    title: 'Name',
    props: {
      placeholder: 'Enter your name'
    }
  }
])

FormKit:

<FormKit
  type="text"
  name="name"
  label="Name"
  placeholder="Enter your name"
  validation="required"
/>

Key Differences

  • FormKit uses a component-based approach, while form-create uses a configuration object
  • FormKit has built-in validation, whereas form-create requires additional setup for validation
  • form-create is primarily focused on Vue.js, while FormKit supports multiple frameworks

Use Cases

  • FormKit: Larger projects with complex forms and validation requirements
  • form-create: Simpler Vue.js projects with straightforward form needs

Community and Support

  • FormKit has a larger community and more frequent updates
  • form-create has a smaller but dedicated user base, primarily in the Vue.js ecosystem
33,863

Build forms in React, without the tears 😭

Pros of Formik

  • Widely adopted in the React ecosystem with extensive community support
  • Integrates seamlessly with React and its component lifecycle
  • Offers a more declarative approach to form handling in React applications

Cons of Formik

  • Limited to React applications, not suitable for Vue.js or other frameworks
  • Requires more boilerplate code for complex form scenarios
  • Steeper learning curve for developers new to React or functional programming concepts

Code Comparison

Form-create (Vue.js):

$formCreate([
    {type: 'input', field: 'name', title: 'Name'},
    {type: 'input', field: 'email', title: 'Email'}
])

Formik (React):

<Formik
  initialValues={{ name: '', email: '' }}
  onSubmit={(values) => handleSubmit(values)}
>
  <Form>
    <Field name="name" type="text" />
    <Field name="email" type="email" />
  </Form>
</Formik>

Key Differences

  • Form-create is designed for Vue.js, while Formik is specifically for React
  • Form-create uses a configuration object approach, Formik uses a more component-based structure
  • Formik provides more granular control over form state and validation
  • Form-create offers a wider range of pre-built form components out of the box
4,460

Performance-focused API for React forms 🚀

Pros of unform

  • Built specifically for React, offering seamless integration with React ecosystems
  • Supports schema validation out of the box using Yup
  • Provides a more flexible and customizable approach to form creation

Cons of unform

  • Limited to React applications, unlike form-create which supports Vue.js
  • May require more setup and configuration compared to form-create's simpler approach
  • Less extensive documentation and community support compared to form-create

Code Comparison

unform:

import React from 'react';
import { Form } from '@unform/web';
import Input from './components/Input';

function MyForm() {
  function handleSubmit(data) {
    console.log(data);
  }

  return (
    <Form onSubmit={handleSubmit}>
      <Input name="email" type="email" />
      <Input name="password" type="password" />
      <button type="submit">Submit</button>
    </Form>
  );
}

form-create:

<template>
  <form-create :rule="rule" v-model="fApi" :option="options" />
</template>

<script>
export default {
  data() {
    return {
      fApi: {},
      rule: [
        { type: 'input', field: 'email', title: 'Email' },
        { type: 'input', field: 'password', title: 'Password', props: { type: 'password' } },
      ],
      options: { onSubmit: this.handleSubmit },
    };
  },
  methods: {
    handleSubmit(formData) {
      console.log(formData);
    },
  },
};
</script>

📋 React Hooks for form state management and validation (Web + React Native)

Pros of react-hook-form

  • Lightweight and performant, with minimal re-renders
  • Seamless integration with React's ecosystem and hooks
  • Extensive documentation and community support

Cons of react-hook-form

  • Limited to React applications only
  • Steeper learning curve for developers new to React hooks
  • Less out-of-the-box UI components compared to form-create

Code Comparison

react-hook-form:

import { useForm } from "react-hook-form";

const { register, handleSubmit } = useForm();
const onSubmit = data => console.log(data);

<form onSubmit={handleSubmit(onSubmit)}>
  <input {...register("firstName")} />
  <input type="submit" />
</form>

form-create:

import formCreate from '@form-create/element-ui'

const form = formCreate([
  {type: 'input', field: 'firstName', title: 'First Name'},
  {type: 'submit', title: 'Submit'}
])

form.on('submit', (formData) => {
  console.log(formData)
})

react-hook-form focuses on form state management within React applications, offering a lightweight solution with excellent performance. It integrates well with React's ecosystem but requires familiarity with hooks. form-create provides a more framework-agnostic approach with built-in UI components, making it potentially easier for beginners but less flexible for complex React applications. The code comparison shows the different approaches: react-hook-form uses hooks and JSX, while form-create uses a configuration object to define form structure.

Simple, lightweight model-based validation for Vue.js

Pros of Vuelidate

  • Lightweight and minimalistic approach to form validation
  • Flexible and customizable, allowing for complex validation rules
  • Seamless integration with Vue.js reactivity system

Cons of Vuelidate

  • Requires more manual setup and configuration compared to form-create
  • Less out-of-the-box UI components and form generation features
  • Steeper learning curve for beginners

Code Comparison

Vuelidate:

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

export default {
  validations: {
    name: { required, minLength: minLength(4) }
  }
}

form-create:

$formCreate([
  {
    type: 'input',
    field: 'name',
    title: 'Name',
    props: {
      required: true,
      minlength: 4
    }
  }
])

Summary

Vuelidate focuses on providing a flexible validation system for Vue.js applications, offering granular control over validation rules. It integrates well with Vue's reactivity but requires more manual setup.

form-create, on the other hand, provides a more comprehensive form generation and validation solution with pre-built UI components. It offers a quicker setup process but may be less flexible for complex custom validations.

The choice between the two depends on the specific project requirements, with Vuelidate being more suitable for projects needing fine-grained validation control, and form-create being better for rapid form development with built-in UI components.

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

FormCreate

官网  |  帮助文档  |  可视化表单设计器  |  移动端表单设计器

TIM dt

FormCreate 是一个可以通过 JSON 生成具有动态渲染、数据收集、验证和提交功能的表单生成组件。支持6个UI框架,适配移动端,并且支持生成任何 Vue 组件。内置20种常用表单组件和自定义组件,再复杂的表单都可以轻松搞定。

FcDesigner

特点

  • 使用JSON数据生成表单
  • 支持扩展,生成任何Vue组件和HTML标签
  • 支持6个UI框架
  • 支持组件之间联动
  • 提供丰富的表单操作API
  • 支持子表单和分组
  • 高性能
  • 适配移动端

支持的UI框架

  • element-plus
  • ant-design-vue
  • naive-ui
  • arco-design
  • tdesign
  • vant

如果对您有帮助,您可以点右上角 "Star" 支持一下 谢谢!本项目还在不断开发完善中,如有任何建议或问题请在这里提出

开发者讨论群629709230

  • 预览

demo1

demo2

更多
  • 操作表单

详细说明

demo2

  • group 组件

详细说明

demo3

  • control 配置项

详细说明

demo2

包说明

包名说明
@form-create/element-ui version npmelement-plus 版本
@form-create/ant-design-vue version npmant-design-vue 版本
@form-create/arco-design version npmarco-design 版本
@form-create/naive-ui version npmnaive-ui 版本
@form-create/tdesign version npmtdesign 版本
@form-create/vant version npmvant 版本(移动端)
@form-create/designer version npm可视化表单设计器

示例

效果图

https://raw.githubusercontent.com/xaboy/form-create/dev/images/sample110.jpg

联系

http://static.form-create.com/file/img/support.jpg

感谢

时光弧线 | wxxtqk | williamBoss | HeyMrLin | djkloop | daiwenyong | JetBrains

License

MIT

Copyright (c) 2018-present xaboy

NPM DownloadsLast 30 Days