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
Copy file name to clipboardExpand all lines: README.md
+34-4Lines changed: 34 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,7 +37,7 @@ A default, very basic CSS stylesheet is provided, though you're encouraged to bu
37
37
38
38
## Usage
39
39
40
-
```js
40
+
```jsx
41
41
importReact, { Component } from"react";
42
42
import { render } from"react-dom";
43
43
@@ -79,7 +79,7 @@ JSONSchema is limited for describing how a given data type should be rendered as
79
79
80
80
Example:
81
81
82
-
```js
82
+
```jsx
83
83
constuiSchema= {
84
84
done: {
85
85
widget:"radio"// could also be "select"
@@ -119,7 +119,7 @@ Here's a list of supported alternative widgets for different JSONSchema data typ
119
119
120
120
The UISchema object accepts a `classNames` property for each field of the schema:
121
121
122
-
```js
122
+
```jsx
123
123
constuiSchema= {
124
124
title: {
125
125
classNames:"task-title foo-bar"
@@ -148,7 +148,7 @@ You can provide your own custom widgets to a uiSchema for the following json dat
148
148
-`boolean`
149
149
-`date-time`
150
150
151
-
```js
151
+
```jsx
152
152
constschema= {
153
153
type:"string"
154
154
};
@@ -179,6 +179,36 @@ The following props are passed to the widget component:
179
179
-`placeholder`: The placeholder value, if any;
180
180
-`options`: The list of options for `enum` fields;
181
181
182
+
## Custom SchemaField
183
+
184
+
**Warning:** This is a powerful feature as you can override the whole form behavior and easily mess it up. Handle with care.
185
+
186
+
You can provide your own implementation of the `SchemaField` base React component for rendering any JSONSchema field type, including objects and arrays. This is useful when you want to augment a given field type with supplementary powers.
187
+
188
+
To proceed so, you can pass a `SchemaField` prop to the `Form` component instance; here's a rather silly example wrapping the standard `SchemaField` lib component:
If you're curious how this could ever be useful, have a look at the [Kinto formbuilder](https://github.com/Kinto/formbuilder) repository to see how it's used to provide editing capabilities to any form field.
0 commit comments