1.2.10 • Published 4 years ago

react-form-contractor v1.2.10

Weekly downloads
118
License
-
Repository
-
Last release
4 years ago

React Form Contractor

WAI-ARIA compliant form generator for React.js

import FormContractor from 'react-form-contractor'

<FormContractor
  componentsMap={componentsMap}
  emitChangeOnLoad
  formData={formData}
  useBuiltInStyle
  onChange={handleFormChange}
  onFormDataChange={handleFormDataChange}
  onSubmit={handleSubmit}
/>

Check out the live demo.

Install

npm install react-form-contractor

API

Props

componentsMap: object (required)

A map of additional components. This will be merged with the library's default components map. You can provide additional components via componentsMap, and those components will be made available for form fields whose type value is in the components map.

emitChangeOnLoad: boolean

Determines whether or not to execute onChange prop when the form builder initially loads. Defaults: false

formData: object (required)

JSON representation of the form to generate.

Schema:

  • label: string (required): Text value that represents a form field, used in label and legend tag.
  • name: string: key value that represents value of a field within a form.
  • type: string: represents what component to use from componentsMap. if a value is set to this field, fields field will be ignored.
  • fields: array of formData: an array of formData to use for a given name field within a form, which will build a nested object structure for your form.
  • options: array: an array of options to be passed to form components that display multiple options to choose from. this field will be ignored if fields is set with a non-empty array.

You can find an example form data in the live demo.

useBuiltInStyle: bool

Determines whether or not to use the library's built-in styles. Defaults: true

onChange: function

Event handler when any values in the form changes. The most up-to-date form values will be passed as an argument.

onFormDataChange: function

Event handler when one of the form components modifies formData. The most up-to-date modified formData values will be passed as an argument.

onSubmit: function

Event handler when the form is submitted. The most up-to-date form values will be passed as an argument.

1.2.10

4 years ago

1.2.9

4 years ago

1.2.8

4 years ago

1.2.7

4 years ago

1.2.6

4 years ago

1.2.5

4 years ago

1.2.4

4 years ago

1.2.3

4 years ago

1.2.2

4 years ago

1.2.1

4 years ago

1.1.9

4 years ago

1.1.8

4 years ago

1.1.7

4 years ago

1.1.6

4 years ago

1.1.5

4 years ago

1.1.4

4 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.2

4 years ago

1.0.3

4 years ago

1.0.1

4 years ago