Convert Figma logo to code with AI

kevinchappell logoformBuilder

A jQuery plugin for drag and drop form creation

2,603
1,380
2,603
94

Top Related Projects

Simple flow library 🖥️🖱️

JavaScript powered Forms with JSON Form Builder

Free JavaScript form builder library with integration for React, Angular, Vue, jQuery, and Knockout.

A frontend Framework for single-page applications on top of REST/GraphQL APIs, using TypeScript, React and Material Design

4,231

Vue Forms ⚡️ Supercharged

Quick Overview

FormBuilder is a JavaScript library that allows users to create dynamic, drag-and-drop form builders for web applications. It provides an intuitive interface for creating and customizing forms without writing code, making it easier for developers and non-developers alike to generate complex forms.

Pros

  • Easy to use drag-and-drop interface
  • Highly customizable with various field types and options
  • Supports multiple languages and localization
  • Generates clean, standards-compliant HTML output

Cons

  • Limited built-in styling options, may require additional CSS
  • Documentation could be more comprehensive
  • Some advanced features may require additional plugins or extensions
  • Performance can slow down with very large, complex forms

Code Examples

  1. Basic form initialization:
const formBuilder = FormBuilder.init(document.getElementById('fb-editor'), {
  fields: ['text', 'number', 'select', 'checkbox'],
  defaultFields: [
    { type: 'text', label: 'Name', name: 'name', required: true }
  ]
});
  1. Retrieving form data:
const formData = formBuilder.actions.getData('json');
console.log(formData);
  1. Adding a custom field type:
FormBuilder.registerField('rating', {
  label: 'Rating',
  attrs: {
    type: 'number',
    min: 1,
    max: 5
  },
  icon: '⭐'
});
  1. Localizing the form builder:
FormBuilder.init(document.getElementById('fb-editor'), {
  i18n: {
    locale: 'fr-FR',
    location: 'https://example.com/formbuilder-lang/'
  }
});

Getting Started

To get started with FormBuilder, follow these steps:

  1. Include the FormBuilder scripts and styles in your HTML:
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/formBuilder/3.7.3/formBuilder.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/formBuilder/3.7.3/formBuilder.min.js"></script>
  1. Create a container element for the form builder:
<div id="fb-editor"></div>
  1. Initialize FormBuilder in your JavaScript:
const formBuilder = FormBuilder.init(document.getElementById('fb-editor'));
  1. To retrieve the form data, use:
const formData = formBuilder.actions.getData('json');

This will give you a basic working form builder. You can further customize it by adding options, fields, and event listeners as needed.

Competitor Comparisons

Simple flow library 🖥️🖱️

Pros of Drawflow

  • Focuses on visual flow-based programming, allowing for intuitive node-based workflow creation
  • Supports custom node types and styling, offering greater flexibility for complex diagrams
  • Provides a more modern and visually appealing interface out of the box

Cons of Drawflow

  • Less suitable for traditional form building tasks compared to formBuilder
  • May have a steeper learning curve for users unfamiliar with flow-based interfaces
  • Documentation is less comprehensive, potentially making integration more challenging

Code Comparison

Drawflow:

var id = drawflow.addNode('github', 2, 2, 150, 50, 'github', {}, 'Github');
drawflow.addConnection(id, 1, 'facebook-api', 2);

formBuilder:

var formBuilder = $(document.getElementById('fb-editor')).formBuilder();
var formData = formBuilder.actions.getData('json');

Summary

Drawflow excels in creating visual workflows and node-based diagrams, offering a modern interface and customizable nodes. However, it may be less intuitive for simple form building tasks. formBuilder is more focused on traditional form creation, with easier integration for basic form-building needs but less flexibility for complex visual representations.

JavaScript powered Forms with JSON Form Builder

Pros of formio.js

  • More comprehensive form-building solution with server-side integration
  • Supports complex form logic and conditional fields
  • Offers a wider range of form components and customization options

Cons of formio.js

  • Steeper learning curve due to its extensive features
  • Requires more setup and configuration for full functionality
  • Larger file size and potentially higher resource usage

Code Comparison

formio.js:

Formio.createForm(document.getElementById('formio'), {
  components: [
    {
      type: 'textfield',
      key: 'firstName',
      label: 'First Name'
    },
    {
      type: 'textfield',
      key: 'lastName',
      label: 'Last Name'
    }
  ]
});

formBuilder:

$(document).ready(function() {
  $('#fb-editor').formBuilder({
    fields: [
      {
        type: 'text',
        label: 'First Name',
        name: 'first-name'
      },
      {
        type: 'text',
        label: 'Last Name',
        name: 'last-name'
      }
    ]
  });
});

Both libraries allow for creating forms programmatically, but formio.js uses a more structured approach with a dedicated Formio object, while formBuilder relies on jQuery and a more straightforward configuration object.

Free JavaScript form builder library with integration for React, Angular, Vue, jQuery, and Knockout.

Pros of survey-library

  • More comprehensive and feature-rich, offering advanced survey capabilities
  • Better documentation and extensive examples for various use cases
  • Active development with frequent updates and a larger community

Cons of survey-library

  • Steeper learning curve due to its complexity and extensive features
  • Larger file size, which may impact load times for simpler projects
  • Commercial license required for some advanced features

Code Comparison

formBuilder:

$(document).ready(function() {
  $('#fb-editor').formBuilder();
});

survey-library:

const survey = new Survey.Model({
  questions: [
    { type: "text", name: "name", title: "Your name:" }
  ]
});
$("#surveyContainer").Survey({ model: survey });

Both libraries offer easy integration, but survey-library provides more customization options out of the box. formBuilder focuses on simplicity, while survey-library offers more advanced features for complex surveys and forms.

survey-library is better suited for large-scale projects with diverse question types and complex logic, while formBuilder is ideal for simpler form creation tasks with a focus on ease of use and quick implementation.

A frontend Framework for single-page applications on top of REST/GraphQL APIs, using TypeScript, React and Material Design

Pros of react-admin

  • More comprehensive admin panel solution with built-in CRUD operations
  • Extensive ecosystem of components and integrations
  • Better suited for complex, data-driven applications

Cons of react-admin

  • Steeper learning curve due to its complexity
  • Less flexibility for simple form creation tasks
  • Requires more setup and configuration

Code Comparison

react-admin:

import { Admin, Resource } from 'react-admin';
import { PostList, PostEdit, PostCreate } from './posts';

const App = () => (
  <Admin dataProvider={...}>
    <Resource name="posts" list={PostList} edit={PostEdit} create={PostCreate} />
  </Admin>
);

formBuilder:

$(document).ready(function() {
  $('#fb-editor').formBuilder();
});

Key Differences

  • react-admin is a full-featured admin panel framework, while formBuilder focuses solely on form creation
  • react-admin uses React and requires more JavaScript knowledge, formBuilder is jQuery-based and easier for beginners
  • react-admin offers more advanced features like authentication and data providers, formBuilder is simpler but more limited in scope

Use Cases

  • Choose react-admin for complex admin interfaces with multiple data types and operations
  • Opt for formBuilder when you need a quick and easy way to create customizable forms without additional admin functionality
4,231

Vue Forms ⚡️ Supercharged

Pros of FormKit

  • More comprehensive form-building solution with built-in validation and error handling
  • Vue.js integration, offering seamless compatibility with Vue applications
  • Extensive documentation and active community support

Cons of FormKit

  • Steeper learning curve due to its more complex architecture
  • Limited customization options compared to FormBuilder's drag-and-drop interface

Code Comparison

FormKit:

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

FormBuilder:

$(container).formBuilder({
  fields: [
    {
      type: 'text',
      label: 'Username',
      name: 'username',
      required: true,
      minLength: 3,
      maxLength: 16
    }
  ]
});

FormKit provides a more declarative approach with built-in validation, while FormBuilder offers a more programmatic setup with greater flexibility in field configuration. FormKit's syntax is more concise and Vue-friendly, whereas FormBuilder's jQuery-based approach may be more familiar to developers working with older technologies.

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

formBuilder npm version Join the chat at https://gitter.im/kevinchappell/formBuilder

A jQuery plugin for drag and drop form creation, formBuilder has many options and is translatable.

Example

jQuery($ => {
  $('#fb-editor').formBuilder()
})

Editor Demo

form-builder

API Demo

Documentation

Browser Support

ChromeFirefoxSafariOperaEdge
Latest ✔Latest ✔Latest ✔Latest ✔Latest ✔

Angular 2/4 Version

Changelog

Translators Needed!

As formBuilder usage grows so does its need to be available in multiple languages. Additions and updates to existing languages are always welcome, see Contributing Languages for details.

NPM DownloadsLast 30 Days