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 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-json-form-factory

v1.3.1

Published

A simple JSON to form convertor for reactJS

Downloads

13

Readme

React Form Builder

A dynamic form builder component for React applications. This component allows you to create customizable forms with various input types and validations.

Features

  • Supports multiple input types: text, password, checkboxes, radio, dropdown, date, datetime-local, file input, number, textarea.
  • Customizable form title and submit button.
  • Validations for required fields, regex patterns, min/max values, and max checked items.
  • Displays error messages for validation failures.

Installation

  npm install react-json-form-factory

Usage

import FormBuilder from "react-json-form-factory"

const formFields=[
    {
        "type": "text",
        "name": "firstName",
        "label": "First Name",
        "value": "",
        "placeholder": "Enter your first name",
    },
    {
        "type": "text",
        "name": "lastName",
        "label": "Last Name",
        "value": "",
        "placeholder": "Enter your last name",
    },
    {
        "type": "email",
        "name": "email",
        "label": "Email",
        "value": "",
        "placeholder": "Enter your email",
    }
]

function App() {
  return <FormBuilder fields={formFields} title={{"text": "My Form"}}/>
}

App Screenshot

Supported Parameters for Forms

| Parameter | Type | Significance | |:-----|:--------:|------:| | styles | Object | used to change default colors and sizes | | gridColumns | String | maximum number of columns in a form | | gap | String | Gap in px, rem or other units between each field | |fields|List of Objects|List of fields in the order you want to display them| |title|Object|Object with the title text and classes to be applied to it| |submit_btn|object|Object with the submit button text and classes| |onSubmit|Function or String|Function to be called while submitting (fields is passed to it), If a string then a POST request will me made to the URL, and if null then the values will be console logged|

Supported Parameters for Field

|Parameter|Type|For|Significance| |:----:|:----:|:----:|:----:| |type|String|All|Used to describe the type of input field| |name|String|All|Used to describe the name of the input field must be unique| |gridSpan|Integer|All|Number of grid cells a field must take| |label|String|All|Used to give label to the field| |placeholder|String|All|Used to give placeholder to the field| |value|String|All|Default value of the field| |required|Bool|All|Makes the field required| |regex|Regex|All|Custom validations| |min|Integer|number, date, datetime-local|Used to give min value to the field| |max|Integer|number, date, datetime-local|Used to give max value to the field| |step|Integer|number, date, datetime-local|Used to give step size to the field| |minChecked|Integer|Checkboxes|Defines the minimum number of checkboxes a user must select| |maxChecked|Integer|Checkboxes|Defines the maximum number of checkboxes a user can select| |customValidation|Function|All|Custom validations using function. The value is passed to the function and it must return true or false|

Authors