Form With Products/Brands/Models
Schema
{}
fields]
:
[0}
:
{name
:
"product_type"
meta}
:
{config}
:
{url
:
"/api/category"
labelKey
:
"name"
valueKey
:
"id"
displayName
:
"Product Type"
displayType
:
"select"
options
:
[]1}
:
{name
:
"brand_id"
meta}
:
{displayName
:
"Brand"
displayType
:
"select"
options
:
[]config}
:
{lazy
:
true
url
:
"/api/category/brands"
queryParams
:
[…
]labelKey
:
"name"
valueKey
:
"id"
dependencies}
:
{exists
:
{…
}options
:
{…
}2}
:
{name
:
"model_id"
meta}
:
{displayName
:
"Model"
displayType
:
"select"
options
:
[]config}
:
{lazy
:
true
url
:
"/api/category/models"
queryParams
:
[…
]labelKey
:
"name"
valueKey
:
"id"
dependencies}
:
{exists
:
{…
}options
:
{…
}Usage
import React from "react";
import MuiForms from "mui-forms";
import schema from "./schema.json";
function FormWithProducts() {
return (
<MuiForms
schema={schema}
onSubmit={async (data) => {
// submit data
}}
/>
);
}