0.0.13 • Published 11 days ago
react-structured-form v0.0.13
React Structured Form
Description
Form templating component for React.
Table of Contents
Installation
npm install react-structured-form -D
Usage
import {Form} from 'react-structured-form';
export default function App(){
<Form
properties={[{
type: 'text',
name: 'contacts-title',
label: 'Title',
required: true,
max: 255,
}, {
type: 'group',
name: 'contacts',
label: 'Contacts',
model: [{
type: 'iterable-group',
name: 'friends',
label: 'Friends',
model: [{
type: "text",
name: "name",
label: "Name",
required: true,
}, {
type: "email",
name: "email",
label: "Email",
required: true,
},]
}, {
type: 'iterable-group',
name: "workplace",
label: "Workplace",
model: [{
type: "text",
name: "name",
label: "Name",
required: true,
}, {
type: "email",
name: "email",
label: "Email",
required: true,
},],
}],
}, {
type: 'checkbox',
name: 'terms',
suffix: 'Accept terms and conditions',
required: true,
}] as const}
primary={{
label: "submit",
onClick: (e) => { alert(`data:${JSON.stringify(e)}`); }
}}
/>
};
TODOList
Guidelines for contributing to your project.
License
This project is licensed under the MIT License.