@evlop/react-schema-form
v1.1.73
Published
<h1>@evlop/react-schema-form</h1>
Downloads
735
Readme
npm install @evlop/react-schema-form
import React from 'react';
import FormBuilder from '@evlop/react-schema-form';
const schema = {
fields: [
{
name: 'name',
label: 'Name',
type: 'text',
required: true
},
{
name: 'email',
label: 'Email',
type: 'email',
required: true
},
{
name: 'age',
label: 'Age',
type: 'number',
required: true
}
]
};
function MyForm() {
return (
<FormBuilder schema={schema} />
);
}
export default MyForm;
function handleSubmit(values) {
console.log(values);
}
function MyForm() {
return (
<FormBuilder schema={schema} handleSubmit={handleSubmit} />
);
}
const messages = {
name: {
required: "Name is required"
}
};
function MyForm() {
return (
<FormBuilder schema={schema} messages={messages} />
);
}