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: docs/Background.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -93,8 +93,8 @@ When a form element is dependent on another form element, it will appear with da
93
93
94
94
The Form Builder also supports the **definitions** property in JSON Schema Form and the resulting **$ref** tags pointing to those definitions. By default, if there are no definitiosn detected in the underlying schema, the option to choose an input type as a reference will be disabled. However, if there is at least one defined definition, then a new option in the *Input Types* dropdown will appear, allowing the Form Builder to select a form input to have a reference to an existing definition. Any changes to that definition will propagate to all form elements that have a reference to it.
95
95
96
-
When a card is of a reference type, many of the usual options are no longer editable - instead, they become inherited from the parent definition.
97
-
98
96

99
97
98
+
Since [this pull request](https://github.com/rjsf-team/react-jsonschema-form/pull/179), the `react-jsonschema-form` package has supported local overrides to `$ref` titles and descriptions. The Form Builder also supports this.
99
+
100
100
In the [usage doc](Usage.md), there is an optional additional component called the **PredefinedGallery** that allows a builder to also visually build the definitions.
@@ -222,9 +222,9 @@ This can then be passed into an app using the `FormBuilder` as follows:
222
222
223
223
```react
224
224
import React, { Component } from 'react';
225
-
225
+
226
226
import { FormBuilder } from 'react-json-schema-form-builder';
227
-
227
+
228
228
class Example extends Component {
229
229
constructor(props) {
230
230
super(props);
@@ -246,7 +246,7 @@ class Example extends Component {
246
246
}}
247
247
mods={
248
248
{
249
-
optionalFormInputs: customFormInputs
249
+
customFormInputs
250
250
}
251
251
}
252
252
/>
@@ -255,26 +255,46 @@ class Example extends Component {
255
255
}
256
256
```
257
257
258
-
The full type definition of the mods that can be passed into the `FormBuilder`and `PredefinedGallery` (they must be passed into both!) are as follows:
258
+
The `customFormInputs` define the logic that translates abstract "Input Types" into raw data schema and UI schema. For more information about these Custon Form Inputs, see the page [here](Mods.md).
259
259
260
-
```react
261
-
export type Mods = {
262
-
customFormInputs?: {
263
-
[string]: FormInput
264
-
},
265
-
tooltipDescriptions?: {
266
-
add?: string,
267
-
cardObjectName?: string,
268
-
cardDisplayName?: string,
269
-
cardDescription?: string,
270
-
cardInputType?: string
271
-
}
260
+
The `tooltipDescriptions` allows an implementation of the `FormBuilder` that changes the tooltip descriptions that appear on hover over certain areas of the tool. The `add` popup appears when hovering over the plus buttons, the `cardObjectName` is the name of the back end name that appears in every card object input, the `cardDisplayName` allows rewriting the description of the display name tooltip, the `cardDescription` option allows overwriting the tooltip for the description, and the `cardInputType` allows setting a custom tooltip for the Input Type dropdown.
261
+
262
+
### Deactivated Form Inputs
263
+
264
+
It is also possible to deactivate (hide) certain Input Types by setting the `deactivatedFormInputs` property on mods. For example, to hide the `time` and `checkbox` form inputs that are usually included by default, you may set the mods to:
265
+
266
+
```react
267
+
mods = {
268
+
deactivatedFormInputs: ['time', 'checkbox'],
272
269
}
273
270
```
274
271
275
-
The `customFormInputs` define the logic that translates abstract "Input Types" into raw data schema and UI schema. For more information about these Custon Form Inputs, see the page [here](Mods.md).
272
+
This will hide these Input Types on the `FormBuilder` component.
276
273
277
-
The `tooltipDescriptions` allows an implementation of the `FormBuilder` that changes the tooltip descriptions that appear on hover over certain areas of the tool. The `add` popup appears when hovering over the plus buttons, the `cardObjectName` is the name of the back end name that appears in every card object input, the `cardDisplayName` allows rewriting the description of the display name tooltip, the `cardDescription` option allows overwriting the tooltip for the description, and the `cardInputType` allows setting a custom tooltip for the Input Type dropdown.
274
+
### Default New Form Element (newElementDefaultDataOptions)
275
+
276
+
By default, when adding a new form element, the dataOptions are set to:
277
+
278
+
```react
279
+
{
280
+
title: `New Input ${i}`,
281
+
type: 'string',
282
+
default: '',
283
+
}
284
+
```
285
+
286
+
This means that by default, a new form element has the "Short answer" input type. If you wish to override this (for example, if the "Short answer" input is deactivated), you can do so by using the `newElementDefaultDataOptions` mod. For example, setting the mods to the following:
287
+
288
+
```react
289
+
mods = {
290
+
newElementDefaultDataOptions: {
291
+
'$ref': '#/definitions/firstNames',
292
+
title: 'Field',
293
+
},
294
+
};
295
+
```
296
+
297
+
will default new form elements to a "Reference" type to some definition "firstNames" defined in the schema.
Copy file name to clipboardExpand all lines: flow-libdef/@ginkgo-bioworks/react-json-schema-form-builder_v1.x.x/flow_v0.92.x-/react-json-schema-form-builder_v1.x.x.js
0 commit comments