1.0.3 • Published 12 months ago
formify-json v1.0.3
FormifyJSON
FormifyJSON is a customizable and dynamic form component for React applications. It supports various input types and conditional display logic.
Installation
You can install FormifyJSON using npm:
npm i formify-json
Or with yarn:
yarn add formify-json
Usage
To use FormRenderer, you'll need to define your form inputs as an array of FormField
objects, each representing a field. FormRenderer supports various input types defined by the FormInputTypes
enum.
Here's an example of how you can define your form fields:
import { FormRenderer, FormField, FormInputTypes } from 'formify-json';
const formInputs: FormField[] = [
{
name: "overallGrade",
label: "How would you rate your overall experience?",
type: FormInputTypes.StarRating,
},
{
name: "detailedFeedback",
label: "What could we do better?",
type: FormInputTypes.MultimediaSuggestion,
placeholder: "Please let us know what aspects of our product or service disappointed you and how we can improve.",
displayCondition: {
questionId: "overallGrade",
operator: "lte",
value: 2,
},
},
// More fields...
];
// Then you can use these fields in the FormRenderer:
<FormifyJSON formFields={formInputs} />
For the details of each type (FormField
, FormInputTypes
, DisplayCondition
), please refer to the type definitions in the package.