Installation

Install

    npm install mui-forms

Peer dependencies

"peerDependencies": {
  "react": "^18.0.0"
}

Basic usage

  1. Define your schema:
{
    "fields": [
        {
            "name": "first_name",
            "meta": {
                "displayType": "text",
                "displayName": "First Name"
            }
        },
        {
            "name": "last_name",
            "meta": {
                "displayType": "text",
                "displayName": "Last Name"
            }
        }
    ]
}
  1. 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
    }}
/>;

Star us at github

© Copyright 2023 MuiForms