Build JSON Forms and Surveys in React
SurveyJS for React is a set of client-side JavaScript libraries for building a custom form and survey management system inside your React application.
Use Form Library to render JSON forms, Survey Creator to design forms visually, Dashboard to analyze responses, and PDF Generator to export forms as PDF files. SurveyJS connects to your own backend, so you keep full control over data storage, access rules, and application logic.
SurveyJS Form Library
- Multi-step forms / form wizard
- Conditional logic
- Dynamic panels / repeatable sections
- Auto-populated fields
- Custom validation
- Calculated values
- Save and restore incomplete forms
import "survey-core/survey-core.min.css";
import { Model } from "survey-core";
import { Survey } from "survey-react-ui";
const surveyJson = {
// ...
};
export function SurveyComponent() {
const survey = new Model(surveyJson);
survey.onComplete.add((sender, options) => {
// Store data in your data storage
console.log(
JSON.stringify(sender.data, null, 3));
});
return <Survey model={survey} />;
}
SurveyJS Survey Creator
- White-label UI
- Customizable Toolbox & Settings Panel
- UI Preset Editor
- Theme Editor
- Custom question types
- Multi-user form editing
- Localization / translations
import { SurveyCreator, SurveyCreatorComponent } from "survey-creator-react";
import "survey-core/survey-core.min.css";
import "survey-creator-core/survey-creator-core.min.css";
const creatorOptions = {
// ...
};
export function SurveyCreatorWidget() {
const creator = new SurveyCreator(creatorOptions);
return <SurveyCreatorComponent creator={creator} />;
}
SurveyJS Dashboard
- Survey results analysis
- Live response updates
- Response filtering and sorting
- Custom visualizers
- Export responses
- Pivot chart
- Table view
const surveyJson = {
// ...
};
const survey = new Survey.Model(json);
const allQuestions = survey.getAllQuestions();
const node = document.getElementById("survey-dashboard");
fetch("https://www.example.com/survey-results/")
.then(response => response.json())
.then(data => {
const vizPanel = new SurveyAnalytics.VisualizationPanel(
allQuestions,
data
);
vizPanel.render(node);
});
SurveyJS PDF Generator
- Export web forms to PDF
- Generate completed response records
- Fill existing PDF forms
- Create read-only PDF documents
- Apply custom fonts
- Configure PDF page size, orientation, and margins
- Customize PDF themes and layouts
import { SurveyPDF } from "survey-pdf";
function prepareSurveyPDF() {
const surveyPDF = new SurveyPDF(json);
surveyPDF.data = survey.data;
return surveyPDF;
}
function savePdfAsFile() {
const surveyPDF = prepareSurveyPDF();
surveyPDF.save("surveyAsFile.pdf");
}
function savePdfAsBlob() {
const surveyPDF = prepareSurveyPDF();
surveyPDF
.raw("bloburl")
.then(function (bloburl) {
const a = document.createElement("a");
a.href = bloburl;
a.download = "surveyAsBlob.pdf";
document.body.appendChild(a);
a.click();
});
}
function previewPdf() {
const surveyPDF = prepareSurveyPDF();
const oldFrame = document.getElementById("pdf-preview-frame");
if (oldFrame)
oldFrame.parentNode.removeChild(oldFrame);
surveyPDF
.raw("dataurlstring")
.then(function (dataurl) {
const pdfEmbed = document.createElement("embed");
pdfEmbed.setAttribute("id", "pdf-preview-frame");
pdfEmbed.setAttribute("type", "application/pdf");
pdfEmbed.setAttribute("style", "width:100%");
pdfEmbed.setAttribute("height", 200);
pdfEmbed.setAttribute("src", dataurl);
const previewDiv = document.getElementById("pdf-preview");
previewDiv.appendChild(pdfEmbed);
});
}
Survey Management System Examples
SurveyJS UI libraries let you build a full-cycle survey management system inside your React application. Users can design forms, publish surveys, submit and review responses, and export completed data to PDF without leaving your app. The same architecture is available for Angular, Vue.js, jQuery, and Vanilla JavaScript.
View examples of such systems for the most popular backend frameworks and CMS.
WordPress
Embed SurveyJS Form Library and Survey Creator in your site using a WordPress plugin.
Domain Model
Generate forms for domain models and edit them in Survey Creator.
Node.js + PostgreSQL
Save forms and user responses in a PostgreSQL database on a Node.js server.
Node.js + MongoDB
Integrate SurveyJS components with a Node.js server that uses a MongoDB database.
Python
Configure client-server interaction of SurveyJS components with a Python backend.
To learn more about how SurveyJS libraries interact with your backend, see the following help topic: Integrate SurveyJS Libraries with Backend
Frequently Asked Questions
Can I build JSON schema forms in React with SurveyJS?
Can I build JSON schema forms in React with SurveyJS?
Yes. SurveyJS lets you build and render JSON schema forms in React. The form structure, question types, validation rules, conditional logic, calculated values, and navigation are defined in JSON. This allows teams to manage form changes through JSON schema updates or Survey Creator, rather than hardcoding each change into React components.
Can I embed Survey Creator into a React app?
Can I embed Survey Creator into a React app?
Yes. Survey Creator can be embedded into a React application as a visual form builder. It gives users a drag-and-drop interface for creating and editing forms without writing code. Behind the scenes, Survey Creator generates a JSON schema that your application can save, manage, and render with SurveyJS Form Library.
Does SurveyJS store form data?
Does SurveyJS store form data?
No. SurveyJS does not store your form schemas, responses, uploaded files, or user data. SurveyJS libraries run in your application, and your team decides where data is stored. You can keep survey definitions and response data in your own database, private cloud, or internal infrastructure.
Can I use SurveyJS with my own database?
Can I use SurveyJS with my own database?
Yes. SurveyJS libraries run on the client side. They are backend-agnostic and can work with any database or server-side technology. Your application can save form JSON schemas, collect responses, manage users, control access, and connect survey data to any internal system.
Is SurveyJS Form Library open source?
Is SurveyJS Form Library open source?
Yes. SurveyJS Form Library is an MIT-licensed open-source JavaScript form library. It can be used to render JSON-driven forms and surveys in React, Angular, Vue, jQuery, and plain JavaScript applications. Other SurveyJS products, such as Survey Creator, Dashboard, and PDF Generator, are commercial libraries with source code available on GitHub.
Can I export SurveyJS forms to PDF?
Can I export SurveyJS forms to PDF?
Yes. SurveyJS PDF Generator lets you create PDF documents from SurveyJS form schemas and response data. You can generate printable forms, completed response records, editable PDF forms, or read-only PDF files. This allows you to use the same JSON form definition for both the web form and the PDF version.
Can I use SurveyJS with Next.js?
Can I use SurveyJS with Next.js?
Yes. SurveyJS can be used in Next.js applications with the React packages.
Still Got Questions?
Check our FAQ or Contact Us