
Security News
PodRocket Podcast: Inside the Recent npm Supply Chain Attacks
Socket CEO Feross Aboukhadijeh discusses the recent npm supply chain attacks on PodRocket, covering novel attack vectors and how developers can protect themselves.
@data-driven-forms/form-builder
Advanced tools
Interactive drag and drop editor for creating data driven forms schema
THIS PROJECT IS WORK IN PROGRESS. ALL THE API IS CONSIDERED UNSTABLE. EVERYTHING CAN BE CHANGED. NEW FEATURES/BUG FIXES CAN TAKE A LONG TIME TO IMPLEMENT.
This component allows to build Data Driven Forms forms via DnD feature.
Table of contents
npm install --save @data-driven-forms/form-builder
or
yarn add @data-driven-forms/form-builder
Import form builder:
import FormBuilder from '@data-driven-forms/form-builder/form-builder';
and render the component with following props:
({ ComponentPicker, PropertiesEditor, DropTarget, isValid, getSchema, children }) => React.Element
Use children or a render function to render the whole editor.
object
Data Driven Forms component mapper. See here.
object
A set of components that creates the form builder.
import { builderComponentTypes } from '../src/constants';
const builderMapper = {
FieldLayout,
PropertiesEditor,
FormContainer,
[builderComponentTypes.BUILDER_FIELD]: builderField,
BuilderColumn,
PropertyGroup,
DragHandle,
EmptyTarget
}
({ children, disableDrag, dragging, selected }) => React.Element
A wrapper around a single field = BUILDER_FORM + DragHandle.
({ propertiesChildren, validationChildren, addValidator, avaiableValidators, handleClose, handleDelete, hasPropertyError }) => React.Element
An editor.
({ children, isDraggingOver }) => React.Element
A wrapper around the form in the form column.
({ innerProps: { hideField, snapshot }, Component, propertyName, fieldId, propertyValidation, hasPropertyError, ...props }) => React.Element
A wrapper around the field.
({ children, isDraggingOver }) => React.Element
A column.
({ className, children, title, handleDelete }) => React.Element
A wrapper around a single property group in the properties editor > validation.
({ dragHandleProps, hasPropertyError, disableDrag }) => React.Element
A drag handle. Is passed as a child to FieldLayout.
() => React.Element
EmptyTarget is shown when there are no fields created.
object
A mapper of editable properties for each component. A property is a object with following attributes:
Editable attributes of the component.
string
Corresponds to an attribute in the schema.
string
A label shown for the property in the editor.
string
A component corresponding to a key in properties mapper.
Disables validator selection in PropertiesEditor
.
Automatically disabled in fields that are not registered in the form state.
Disables initial value field in PropertiesEditor
.
Automatically disabled in fields that are not registered in the form state.
const LABEL = {
propertyName: 'label',
label: 'Label',
component: 'input'
}
const componentProperties = {
[componentTypes.TEXT_FIELD]: {
attributes: [LABEL, IS_REQUIRED]
},
[componentTypes.PLAIN_TEXT]: {
attributes: [LABEL],
disableValidators: true,
disableInitialValue: true
}
}
object
A mapper of components available in the editor.
const pickerMapper = {
[componentTypes.TEXT_FIELD]: ({ component }) => <div>{component}</div>
}
object
A mapper of components available in component properties.
const propertiesMapper = {
input: ({ label, value, fieldId, innerProps: { propertyValidation }, ...rest }) => <input {...rest} />
}
one of 'subset' | 'default' optional
If 'subset', options will be only editable to certain degree. See schemaTemplate.
object optional
A Data Driven Forms schema. See here.
object optional
An original schema from which a subset is created. If not specified, editable boundaries will be created from the schema.
boolean optional
Components from the components list are being cloned when dragged.
boolean optional
Turns on debug mode. Will show current field as a JSON object.
boolean optional
Opens the first field on mount.
boolean optional
Disables adding new fields.
boolean optional
Disables dragging.
Form builder contains two mappers of components: PatternFly 4 and Material UI versions.
import {
pickerMapper,
propertiesMapper,
builderMapper,
BuilderTemplate,
fieldProperties
} from '@data-driven-forms/form-builder/mui-builder-mappers';
import {
pickerMapper,
propertiesMapper,
builderMapper,
BuilderTemplate,
fieldProperties
} from '@data-driven-forms/form-builder/pf4-builder-mappers';
render={({ isValid, getSchema, ...props }) => (
<BuilderTemplate {...props} className={classes.builderWrapper}>
<CodeEditor value={JSON.stringify(getSchema(), null, 2)} />
</BuilderTemplate>
)}
FAQs
Interactive drag and drop editor for creating data driven forms schema
The npm package @data-driven-forms/form-builder receives a total of 87 weekly downloads. As such, @data-driven-forms/form-builder popularity was classified as not popular.
We found that @data-driven-forms/form-builder demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket CEO Feross Aboukhadijeh discusses the recent npm supply chain attacks on PodRocket, covering novel attack vectors and how developers can protect themselves.
Security News
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
Product
Socket Firewall is a free tool that blocks malicious packages at install time, giving developers proactive protection against rising supply chain attacks.