You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A simple [React](http://facebook.github.io/react/) component capable of building
7
-
HTML forms out of a [JSON schema](http://jsonschema.net/).
6
+
A simple [React](http://facebook.github.io/react/) component capable of building HTML forms out of a [JSON schema](http://jsonschema.net/).
8
7
9
8
Requires React 0.14+.
10
9
@@ -60,15 +59,46 @@ render((
60
59
), document.getElementById("app"));
61
60
```
62
61
62
+
### Alternative widgets
63
+
64
+
JSONSchema is limited for describing how a given data type should be rendered as an input component, that's why this lib introduces the concept of *UI schema*. A UI schema is basically an object literal describing which UI widget should be used to render a certain field
65
+
66
+
Example:
67
+
68
+
```js
69
+
constuiSchema= {
70
+
done: {
71
+
widget:"radio"// could also be "select"
72
+
}
73
+
};
74
+
75
+
render((
76
+
<Form schema={schema}
77
+
uiSchema={uiSchema}
78
+
formData={formData} />
79
+
), document.getElementById("app"));
80
+
```
81
+
82
+
Here's a list of supported alternative widgets for different JSONSchema data types:
83
+
84
+
#### `boolean`
85
+
86
+
*`radio`: a radio button group with `true` and `false` as selectable values;
87
+
*`select`: a select box with `true` and `false` as options;
88
+
* by default, a checkbox is used
89
+
90
+
#### `string`:
91
+
92
+
*`textarea`: a `textarea` element
93
+
* by default, a regular `input[type=text]` element is used.
94
+
63
95
## Development server
64
96
65
97
```
66
98
$ npm start
67
99
```
68
100
69
-
A [Cosmos development server](https://github.com/skidding/cosmos) showcasing
70
-
components with hot reload enabled is available at
71
-
[localhost:8080](http://localhost:8080).
101
+
A [Cosmos development server](https://github.com/skidding/cosmos) showcasing components with hot reload enabled is available at [localhost:8080](http://localhost:8080).
0 commit comments