<form.io> has a React module that allows building out forms and APIs on <form.io> and then embedding everything directly into your application with one line of code. When using this method, there is no other work needed to allow users to create, edit and delete resources within your application and when you make changes to the forms, they immediately update within your application.
The react-formio module can be found at https://github.com/formio/react-formio.
The React Form.io library offers full dynamic form rendering within the Form.io platform, as well as other helper libraries that make it easy to build React.js applications on top of Form.io.
Adding the React Module
npm install react-formio --save
The browser bundle exposes a global
Formio variable and expects to find
React variable to work with.
You can find it in the /dist directory.
Using the React Module
src property and render:
var React = require('react'); var Formio = require('react-formio'); // React <= 0.13 React.render( <Formio src="https://example.formio/example" /> , document.getElementById('example') ); // React >= 0.14 var ReactDOM = require('react-dom'); ReactDOM.render( <Formio src="https://example.formio/example" /> , document.getElementById('example') );
The form API source from form.io or your custom formio server.
See 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.
src will override this property if used.
An object representing the default data for the form.
src will override this if a submission url is entered.
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.