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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@formsjs/react-antd

v1.0.7

Published

Made with create-react-library

Readme

@formsjs/react-antd

A Dynamic Form Generating library based in antd for all who hate creating forms

NPM JavaScript Style Guide

Install

npm install --save @formsjs/react-antd

Usage

import React, {useState} from 'react'

import DynamicForm from '@formsjs/react-antd'

const App = () => {
  const [firstName, setFirstName] = useState("")
  const [lastName, setLastName] = useState("")
  const [age, setAge] = useState(0)
  const [message, setMessage] = useState("")

  const script = [
    [
      {
        type: 'text',
        name: 'First Name',
        value: firstName,
        onChange: (event) => {
          setFirstName(event.target.value)
        }
      },
      {
        type: 'text',
        name: 'Last Name',
        value: lastName,
        onChange: (event) => {
          setLastName(event.target.value)
        }
      }
    ],
    [
      {
        type: 'number',
        name: 'Age',
        value: age,
        onChange: (value) => {
          setAge(value)
        }
      },
      {
        type: 'textarea',
        name: 'Message',
        value: message,
        onChange: (event) => {
          setMessage(event.target.value)
        }
      }
    ]
  ]

  return (
    <div className="w-100 p-5">
      <DynamicForm script={script}/>
    </div>
  )
}

export default App

Types

Text

{
  type: 'text',
  name: 'First Name',
  value: firstName,
  onChange: (event) => {
    setFirstName(event.target.value)
  }
}

Optional Props (Text)

{
  placeholder: "First Name",                 // For placeholders
  fieldStyle: {fontSize: 12},                // For custom Style Injections
  fieldClassName: "font-weight-bold",        // For custom css class injection
  customLable: <label>Required</label>,      // For small labels on top
  fieldId: "my-id",                          // For custom css id's
  disabled: false                            // For disabling the field
  colClassName: "text-right",                // For Column Level styles
  bottomElement: <label>Bottom Element</label>,
  /*
    Any JSX element that you may like at the bottom
  */
  lg: 24,
  /*
    lg: 1 to 24 or { span: 11, offset: 1 }
    Just like antd grid System
  */
}

Password

{
  type: 'password',
  name: 'Password',
  value: password,
  onChange: (event) => {
    setPassword(event.target.value)
  }
}

Optional Props (Password)

{
  placeholder: "First Name",                 // For placeholders
  fieldStyle: {fontSize: 12},                // For custom Style Injections
  fieldClassName: "font-weight-bold",        // For custom css class injection
  customLable: <label>Required</label>,      // For small labels on top
  disabled: false                            // For disabling the field
  colClassName: "text-right",                // For Column Level styles
  bottomElement: <label>Bottom Element</label>,
  /*
    Any JSX element that you may like at the bottom
  */
  lg: 24,
  /*
    lg: 1 to 24 or { span: 11, offset: 1 }
    Just like antd grid System
  */
}

Date

{
  type: 'date',
  value: dob,                   //value = typeof(Date)
  name: 'Date of Brith',
  onChange: (event) => {
    setDob(event)
  }
}

Optional Props (Date)

{
  placeholder: "MM-DD-YYYY",                 // For placeholders
  fieldStyle: {fontSize: 12},                // For custom Style Injections
  fieldClassName: "font-weight-bold",        // For custom css class injection
  disabled: false                            // For disabling the field
  colClassName: "text-right",                // For Column Level styles
  formate: ["MM-DD-YYYY", "MM-DD-YY"],       // For Date Formate DEFAULT: ["DD/MM/YYYY", "DD/MM/YY"]
  lg: 24,
  /*
    lg: 1 to 24 or { span: 11, offset: 1 }
    Just like antd grid System
  */
}

Number

{
  type: 'number',
  value: count,
  name: 'Number',
  onChange: (value) => {
    setCount(value)
  }
}

Optional Props (Number)

{
  placeholder: "Count",                      // For placeholders
  fieldStyle: {fontSize: 12},                // For custom Style Injections
  fieldClassName: "font-weight-bold",        // For custom css class injection
  disabled: false                            // For disabling the field
  colClassName: "text-right",                // For Column Level styles
  min: 0,                                    // For Min value
  max: 10,                                   // For max value
  lg: 24,
  /*
    lg: 1 to 24 or { span: 11, offset: 1 }
    Just like antd grid System
  */
}

Textarea

{
  type: 'textarea',
  name: 'Message',
  value: message,
  onChange: (event) => {
    setMessage(event.target.value)
  }
}

Optional Props (Textarea)

{
  placeholder: "Message",                    // For placeholders
  fieldStyle: {fontSize: 12},                // For custom Style Injections
  fieldClassName: "font-weight-bold",        // For custom css class injection
  customLable: <label>Required</label>,      // For small labels on top
  fieldId: "my-id",                          // For custom css id's
  disabled: false                            // For disabling the field
  colClassName: "text-right",                // For Column Level styles
  autoSize: true,                            // For Autosizing
  bottomElement: <label>Bottom Element</label>,
  /*
    Any JSX element that you may like at the bottom
  */
  lg: 24,
  /*
    lg: 1 to 24 or { span: 11, offset: 1 }
    Just like antd grid System
  */
}

Upload

{
  {
    type: 'upload',
    name: 'File',
    onRemove: (event) => {
      setFile(undefined)
    },
    beforeUpload: async (event) => {
      setFile(await toBase64(event))
    }
  }
}

Optional Props (Upload)

{
  placeholder: "File",                       // For placeholders
  fieldStyle: {fontSize: 12},                // For custom Style Injections
  fieldClassName: "font-weight-bold",        // For custom css class injection
  fieldId: "my-id",                          // For custom css id's
  disabled: false                            // For disabling the field
  colClassName: "text-right",                // For Column Level styles
  multiple: false,
  accept: '.doc,.docx',
  method: 'post',
  action: 'https://www.mocky.io/v2/5cc8019d300000980a055e76',
  onRemove: (event) => {
    setFile(undefined)
  },
  beforeUpload: async (event) => {
    setFile(await toBase64(event))
  },
  onChange: (event) => {
    console.log(event)
  }
  lg: 24,
  /*
    lg: 1 to 24 or { span: 11, offset: 1 }
    Just like antd grid System
  */
}
toBase64
const toBase64 = (file) => new Promise((resolve, reject) => {
  const reader = new FileReader();
  reader.readAsDataURL(file);
  reader.onload = () => resolve(reader.result);
  reader.onerror = error => reject(error);
});

Checkbox

{
  type: 'checkbox',
  name: 'Subjects',
  checkboxList: [
    {
      name: 'OOP',                          //Optional
      disabled: false,                      //Optional
      checked: subjects.oop,
      onChange: (event) => {
        setSubjects({ ...subjects, oop: event.target.checked})
      }
    },
    {
      name: 'DSA',
      disabled: false,
      checked: subjects.dsa,
      onChange: (event) => {
        setSubjects({ ...subjects, dsa: event.target.checked})
      }
    }
  ]
}

License

MIT © mustafasheikh1