opinbox-builder
v0.2.2
Published
A toolkit to build 'external' survey for Opinbox (https://opinbox.vercel.app).
Downloads
15
Maintainers
Readme
Opinbox Builder
Opinbox Builder is a flexible and powerful survey creation tool for React projects. It allows developers to easily build and deploy surveys and connect them to Opinbox to manage the survey data.
During development, users can create and export surveys in JSON format, which can then be used in production builds. Note that for commercial use, a SurveyJS license is required to use the survey creator.
1. Installation
To install Opinbox Builder, you need to include it as a dependency in your project. Here are the steps to set it up:
npm install opinbox-builder
2. Usage
Import Styles
Import the styles for your UI components.
/* Import the Opinbox-Builder Styles */
@import "opinbox-builder/dist/style.css";
Development Mode
In development mode, users can build their survey and export it as a JSON file. The following example shows how to set up the Opinbox Builder in your React project:
App.tsx
import { OpinboxBuilder } from "opinbox-builder";
import { json } from "./survey/json"; // This is your production survey
import "./App.css";
function App() {
const isDev = import.meta.env.DEV; // Vite
return (
<>
<OpinboxBuilder dev={isDev} surveyJson={json}></OpinboxBuilder>
</>
);
}
export default App;
./survey/json.ts
export const json = {
// Your survey JSON here
};
Production Mode
In production mode, the JSON survey created during development will be bundled into a runnable HTML and JS survey that you can deploy on your server. To build for production, run:
npm run build
Examples
You can find example projects here.
Additional Information
Opinbox Builder relies on several peer dependencies. Ensure these are installed in your project:
"peerDependencies": {
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.23.1"
}
License
Opinbbox-builder runs under the MIT License.
For commercial use, a SurveyJS license is required to use the survey creator. Please ensure you have obtained the appropriate license before using this package in a commercial project.