Install
npm install mui-forms
Peer dependencies
"peerDependencies": {
"react": "^18.0.0"
}
Basic usage
- Define your schema:
{
"fields": [
{
"name": "first_name",
"meta": {
"displayType": "text",
"displayName": "First Name"
}
},
{
"name": "last_name",
"meta": {
"displayType": "text",
"displayName": "Last Name"
}
}
]
}
- Import and use MuiForms:
import MuiForms from "mui-forms";
import schema from "<schema_location.json>";
<MuiForms
name="myForm"
schema={schema}
onChange={(...data) => {
// handle data on change
}}
onError={(...fieldData) => {
// handle error
}}
onNext={(formData) => {
// handle next
}}
onSubmit={(formData) => {
// handle form submission
}}
/>;