npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

todo-form

v1.3.1

Published

FormBuilder and FormRender.

Readme

todo-form

npm version license github

A jQuery-based drag-and-drop Form Builder and Form Renderer built on top of Bootstrap 5.

Build forms visually, save them as JSON, and render them anywhere.


Requirements


Installation

npm i todo-form
pnpm add todo-form

Usage

1. Include dependencies in your HTML

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons/font/bootstrap-icons.min.css">

<script src="https://cdn.jsdelivr.net/npm/jquery@3/dist/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/jquery-ui@1/dist/jquery-ui.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5/dist/js/bootstrap.bundle.min.js"></script>

2. Import the library

import 'todo-form';

Form Builder

Create an interactive form builder inside any container element.

<div id="my-builder"></div>
const builder = $("#my-builder").formBuilder();

The builder renders a full editor UI with a sidebar of available elements, a drag-and-drop canvas, and a configuration panel.

Get form data

Returns an array of field objects representing the current form state.

const data = builder.getData();
// data is an array, e.g.:
// [{ _type: "text", label_text: "Name", name: "name", required: true, ... }, ...]

Set form data

Load a previously saved form into the builder.

builder.setData(data);

Submit / serialize

When the builder is inside a <form>, submitting it replaces the builder UI with a hidden <textarea name="data"> containing the form JSON. You can also trigger it manually:

builder.submit();

Form Render

Render a saved form from JSON data into any container element.

<div id="my-form"></div>
const data = [...]; // array from builder.getData()

$("#my-form").formRender(data);

The rendered output is a set of Bootstrap 5 form elements ready to use inside a <form>.


Data Format

Form data is a JSON array where each object represents one element. Every object must have a _type field.

[
  {
    "_type": "header",
    "text": "Registration",
    "size": 12,
    "item_type": "h1",
    "color": ""
  },
  {
    "_type": "text",
    "label_text": "First name",
    "placeholder": "Enter your name",
    "name": "first_name",
    "id": "first_name",
    "size": 6,
    "required": true,
    "field_size": 0,
    "maxlength": null
  },
  {
    "_type": "select",
    "label_text": "Country",
    "name": "country",
    "id": "country",
    "size": 6,
    "required": false,
    "options": ["Russia", "USA", "Germany"]
  },
  {
    "_type": "button",
    "text": "Submit",
    "item_type": "submit",
    "color": "primary",
    "size": 12,
    "id": "",
    "name": ""
  }
]

Available Elements

| _type | Description | Key params | |--------------|--------------------------|------------| | header | Heading (h1–h6) | text, size, color, item_type | | paragraph | Text paragraph | text, size, color, align | | text | Text input | label_text, placeholder, name, id, required, maxlength | | number | Number input | label_text, placeholder, name, id, required, min, max, step | | textarea | Textarea | label_text, placeholder, name, id, required, rows, maxlength | | date | Date input | label_text, name, id, required, min, max | | datetime | Date + time input | label_text, name, id, required, min, max | | password | Password input | label_text, placeholder, name, id, required, maxlength | | file | File upload | label_text, name, id, required, accept, disabled | | checkbox | Checkbox | label_text, name, id, required, disabled, value | | select | Dropdown select | label_text, name, id, required, options | | datalist | Input with suggestions | label_text, placeholder, name, id, required, options | | hidden | Hidden input | name, id, value, disabled | | button | Button | text, item_type, color, name, id | | hr | Horizontal line | size | | div | Empty container block | id, size | | part | Nested form section | id, size, formrender |

size is a Bootstrap grid column span (1–12). field_size controls Bootstrap form-control-sm/lg sizing (0 = default).


Full Example

<!DOCTYPE html>
<html>
<head>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5/dist/css/bootstrap.min.css">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons/font/bootstrap-icons.min.css">
</head>
<body>
  <div class="container mt-4">
    <div id="builder"></div>
    <button id="save" class="btn btn-success mt-3">Save & Render</button>
    <hr>
    <form id="render-target" class="row g-3 mt-2"></form>
  </div>

  <script src="https://cdn.jsdelivr.net/npm/jquery@3/dist/jquery.min.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/jquery-ui@1/dist/jquery-ui.min.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/bootstrap@5/dist/js/bootstrap.bundle.min.js"></script>
  <script type="module">
    import 'todo-form';

    const builder = $("#builder").formBuilder();

    $("#save").on("click", () => {
      const data = builder.getData();
      $("#render-target").empty().formRender(data);
    });
  </script>
</body>
</html>

Links


License

MIT