react-jsonschema-form demo
https://github.com/mozilla-services/react-jsonschema-form
HTML
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.3.2/react-dom.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.3.2/react.min.js"></script>
<script src="https://unpkg.com/react-jsonschema-form/dist/react-jsonschema-form.js"></script>
<div class="container">
<div id="main"></div>
</div>
Babel + JSX
const Form = JSONSchemaForm.default;
const schema = {
"type": "object",
"definitions": {
"can": {
"type": "object",
"properties": {
"phy": {
"title": "TitleX",
"type": "object",
"properties": {
"bit_rate_cfg_mode": {
"title": "TitleY",
"type": "integer",
"default": 0,
"anyOf": [
{
"title": "A",
"enum": [
0
]
},
{
"title": "B",
"enum": [
1
]
},
{
"title": "C",
"enum": [
2
]
}
]
}
},
"dependencies": {
"bit_rate_cfg_mode": {
"oneOf": [
{
"properties": {
"bit_rate_cfg_mode": {
"enum": [
0
]
}
}
},
{
"properties": {
"bit_rate_cfg_mode": {
"enum": [
1
]
}
}
},
{
"properties": {
"bit_rate_cfg_mode": {
"enum": [
2
]
},
"brp": {
"title": "XYZ 1",
"type": "integer",
"default": 12,
"minimum": 1
}
}
}
]
}
}
}
}
}
},
"properties": {
"can_1": {
"title":...