This repository is now considered legacy and no longer supported. Please take a look at our recent repositories and help documentation at the following links.
- https://help.form.io
- https://github.com/formio/formio.js
- https://github.com/formio/formio
- https://github.com/formio/react
- https://github.com/formio/angular
- https://github.com/formio/vue
A React component for rendering out forms based on the Form.io platform.
React Formio
can be used on the server, or bundled for the client using an
npm-compatible packaging system such as Browserify or
webpack.
npm install react-formio --save
The browser bundle exposes a global Formio
variable and expects to find
a global React
variable to work with.
You can find it in the /dist directory.
Give Formio
a src
property and render:
** For es5 require() modules. **
var React = require('react');
var ReactDOM = require('react-dom');
var Formio = require('react-formio').Formio;
** For es6 import/export modules. **
import React from 'react';
import ReactDOM from 'react-dom';
import {Formio} from 'react-formio';
ReactDOM.render(
<Formio src="https://example.form.io/example" />
, document.getElementById('example')
);
The form API source from form.io or your custom formio server.
See the Creating a form for where to set the API Path for your form.
You can also pass in the submission url as the src
and the form will render with the data populated from the submission.
An object representing the form. Use this instead of src for custom forms.
Note: src
will override this property if used.
An object representing the default data for the form.
Note: src
will override this if a submission url is entered.
A function callback that will be called when any field is changed. The full submission is passed as well as the field that is changing's key and value.
A function callback that will be called when a submission is successful.
A function callback that will be called when a submisison is unsuccessful.
A function callback that will be called with a form is finished loading.
A function callback that will be called after a submission is loaded.
A function callback that will be called each time a component is rendered.
A settings object to pass various options into the form. skipInit will stop the form from initialling setting values on the submission object which will result in data only changing when a user interacts with the form.
options={
skipInit: true
}
Released under the MIT License.