lx-dynamic-form
v0.2.0
Published
JSON in JSON out form builder
Downloads
33
Readme
lx-dynamic-form
JSON in JSON out form builder
install
npm i lx-dynamic-form
usage
import DynamicForm from "lx-dynamic-form";
const formData = {
name: "ACCESS",
headline: "access",
controls: [
{
id: 1,
key: "password",
type: "TEXT_INPUT",
required: true,
data: {
type: "password",
placeholder: "Password",
defaultValue: "aaaaaaaa",
validations: ["PASSWORD"],
},
},
{
id: 2,
key: "country",
type: "SELECT",
required: false,
data: {
placeholder: "Country",
options: ["AU", "UK", "ZA"].map((v) => ({ key: v, value: v })),
},
},
],
btnText: "submit",
};
const App = () => (
<DynamicForm
formData={formData}
onComplete={(data) => console.log(data)}
onInvalid={(data, invalids) => console.log(invalids)}
/>
);
controls
TEXT_INPUT SELECT