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

simple-react-form-builder

v2.0.5

Published

Build forms in react with a config object

Readme

Simple React Form Builder

Build simple forms with bootstrap 3 markup using config files within react.

Requires REACT 16

Example useage:

Example index.js

import FormBuilder from 'simple-react-form-builder'
const formProps = require('/path/to/formConfig.js')

render () {
  return(
    <FormBuilder {...formProps} />
  )
}

Example props to generate a form with a submit function that serializes form data

Example formConfig.js

const expires = new Date()
expires.setDate(expires.getDate() + 14)

module.exports = {
  submitClass: 'btn btn-primary',
  submitText: 'Send!',
  inputClass: 'form-builder-input',
  checkboxContainerClass: 'checkbox form-group',
  formAction: 'javascript:void(0)',
  onSubmit: function (e) {
    const formInputs = e.target.querySelectorAll('.form-builder-input')
    const submitObject = {}
    Object.keys(formInputs).forEach(key => {
      const item = formInputs[key]
      if (!item.name) return
      if (item.type === 'checkbox') submitObject[item.name] = item.checked
      else submitObject[item.name] = item.value
    })
    console.log(submitObject)
  },
  cookies: {
    namePrefix: 'example_cookies',
    path: '/',
    expires
  },
  inputs: {
    firstName: {
      type: 'text',
      label: 'First Name',
      attributes: {
        name: 'first_name',
        placeholder: 'First Name',
        required: 'required',
        defaultValue: 'Waza'
      }
    },
    RoomType: {
      type: 'select',
      label: 'Options',
      attributes: {
        name: 'options',
        placeholder: 'Options',
        defaultValue: '2'
      },
      options: {
        '1': 'One',
        '2': 'Two',
        '3': 'Three'
      }
    },
    test: {
      type: 'hidden',
      attributes: {
        name: 'hidden_input',
        required: 'required',
        value: '1'
      }
    },
    yourEmail: {
      type: 'email',
      label: 'Your Email',
      attributes: {
        name: 'email',
        placeholder: 'Your Email Address',
        required: 'required'
      }
    },
    enquiry: {
      type: 'textarea',
      label: 'Enquiry',
      attributes: {
        name: 'enquiry',
        rows: 3,
        required: 'required'
      }
    },
    signup: {
      type: 'checkbox',
      label: 'Signup to our newsletter',
      attributes: {
        name: 'newsletter',
        defaultChecked: false
      }
    }
  }
}

Optional Props for customisation:

If you want to include cookies you can use the cookies prop, everything in the cookies object is optional apart from namePrefix which is required. Your cookies will be named like this ${cookies.namePrefix}_${name of input} if your input does not have a name, then no cookie will be stored for it.

{
  cookies: {
    namePrefix: 'example_cookies',
    path: '/',
    expires,
    maxAge: 1000,
    domain: 'https://example-domain.com',
    secure: true,
    httpOnly: false
  },
  onSubmit: func, // Function to run when the form submits
  submitText: 'Send', // Defaults to 'Submit'
  formAction: '/where-to-submit.html',
  submitClass: 'btn btn-primary', // Goes onto the submit button
  inputClass: 'form-builder-input', // This class gets applied to all inputs generated
  checkboxContainerClass: 'checkbox form-group', // This class gets applied to checkbox containers
  submitButton: false // Set to false to not render a submit button
}