JSON powered forms for React.js
A React library for rendering out forms based on the Form.io platform.
For the latest documentation, release information, and guides, always refer to the official Form.io Help Documentation available here:
npm install @formio/react --save
npm install @formio/js --saveyarn add @formio/react @formio/jsWhen using @formio/react in a project built with Vite (especially for React 18 and 19), make sure you install the @vitejs/plugin-react package and configure it in your vite.config.js file.
Install Vite React Plugin
yarn add --dev @vitejs/plugin-reactIn your vite.config.js, add the React plugin:
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
export default defineConfig({
plugins: [react()],
});A hook to supply global Formio contextual values to your React components. Components that call useFormioContext must be children of a `` component.
useFormioContext returns an object with the following parameters:
| Name | Type | Description |
|---|---|---|
| Formio | typeof Formio | The global Formio object. Useful for various static methods as well as SDK functions that are exposed when the new operator is used. |
| baseUrl | string | The base url for a Form.io server. |
| projectUrl | string | The base url for a Form.io enterprise project. |
| logout | () => void | A convenience method to logout of a Form.io session by invalidating the token and removing it from local storage. |
| token | string | The Form.io JWT-token (if the user is authenticated). |
| isAuthenticated | boolean | A convenience value that is toggled when logging in or out of a Form.io session. |
Use the authentication context provided by useFormioContext to evaluate the Form.io authentication of a user:
import { createRoot } from 'react-dom/client';
import { useFormioContext, FormGrid, FormioProvider } from '@formio/react';
const App = () => {
const { isAuthenticated } = useFormioContext();
return isAuthenticated ? (
setLocation(`/form/${id}`)}
/>
setLocation(`/resource/${id}`)}
/>
) : (
);
};
const domNode = document.getElementById('root');
const root = createRoot(domNode);
root.render(
,
);Use the Form.io SDK to interact with a Form.io server:
…A React context provider component that is required when using some hooks and components from this library.
| Name | Type | Description |
|---|---|---|
| Formio | object | The Formio object to be used. |
| baseUrl | string | The base url of a Form.io server. |
| projectUrl | string | The url of a Form.io enterprise project. |
Render a simple form from your self hosted Form.io deployment:
import { createRoot } from 'react-dom/client';
import { Form, FormioProvider } from '@formio/react';
const domNode = document.getElementById('root');
const root = createRoot(domNode);
root.render(
);Extend the Formio object to use external modules:
import { createRoot } from 'react-dom/client';
import { Form, FormioProvider } from '@formio/react';
import { Formio } from '@formio/js';
import premium from '@formio/premium';
const domNode = document.getElementById('root');
const root = createRoot(domNode);
Formio.use(premium);
root.render(
);A React component wrapper around a Form.io form. Able to take a JSON form definition or a Form.io form URL and render the form in your React application.
| Name | Type | Default | Description |
|---|---|---|---|
src |
Webform | string |
The JSON form definition or the source URL. If a URL, commonly from a form.io server. | |
url |
string |
The url of the form definition. Used in conjunction with a JSON form definition passed to src, this is used for file upload, OAuth, and other components or actions that need to know the URL of the Form.io form for further processing. The form will not be loaded from this url and the submission will not be saved here either. |
|
submission |
JSON |
Submission data to fill the form. You can either load a previous submission or create a submission with some pre-filled data. If you do not provide a submissions the form will initialize an empty submission using default values from the form. | |
options |
FormOptions |
The form options. See here for more details. | |
onFormReady |
(instance: Webform) => void |
A callback function that gets called when the form has rendered. It is useful for accessing the underlying @formio/js Webform instance. | |
onSubmit |
(submission: JSON, saved?: boolean) => void |
A callback function that gets called when the submission has started. If src is not a Form.io server URL, this will be the final submit event. |
|
onCancelSubmit |
() => void |
A callback function that gets called when the submission has been canceled. | |
onSubmitDone |
(submission: JSON) => void |
A callback function that gets called when the submission has successfully been made to the server. This will only fire if src is set to a Form.io server URL. |
|
onChange |
(value: any, flags: any, modified: any) => void |
A callback function that gets called when a value in the submission has changed. | |
onComponentChange |
(changed: { instance: Webform; component: Component; value: any; flags: any}) => void |
A callback function that gets called when a specific component changes. | |
onError |
(error: EventError | false) => void |
A callback function that gets called when an error occurs during submission (e.g. a validation error). | |
onRender |
(param: any) => void |
A callback function that gets called when the form is finished rendering. param will depend on the form and display type. |
|
onCustomEvent |
(event: { type: string; component: Component; data: JSON; event?: Event; }) => void |
A callback function that is triggered from a button component configured with "Event" type. | |
onPrevPage |
(page: number, submission: JSON) => void |
A callback function for Wizard forms that gets called when the "Previous" button is pressed. |
[BUG] Signature component fires change event with `modified = false` on user input
Two loading spinners are displayed
onChange `modified` property remains false when file component is updated
FormBuilder with OnChange broke textarea
FormBuilder onChange callback not triggered when options prop is provided
Custom component fails after upgrading @formio/[email protected]
Branch Reorganization Update – 2 September 2025
I dont find any information for options to FormBuilder component
Customize Drag and Drop Zone
Changing the display from form to wizard to form and then removing the panel breaks the builder