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: packages/react-renderer-demo/src/app/pages/renderer/renderer-api.md
+7-14Lines changed: 7 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,46 +17,39 @@ Form Renderer provides a lot of customization via props.
17
17
|Prop|Type|Description|
18
18
|----|:--:|----------:|
19
19
|<RouterLinkhref="/renderer/component-mapping"><Linkhref="/renderer/component-mapping">componentMapper</Link></RouterLink>|object|Defines types of form field components. Field components can change the state of the form.|
20
-
|<RouterLinkhref="/renderer/component-mapping"><Linkhref="/renderer/component-mapping">layoutMapper</Link></RouterLink>|object|Defines types of layout components, which can't change the state of the form.|
20
+
|<RouterLinkhref="/renderer/component-mapping"><Linkhref="/renderer/component-mapping">FormTemplate</Link></RouterLink>|Component|Components which defines a template of the form. This component receives two props from the renderer: `formFields` and `schema`. `formFields` is the content of the form. You should wrap this content into your `<form>` component and add form buttons.|
21
21
|onSubmit|func|A submit callback which receives two arguments: `values` and `formApi`.|
22
22
|schema|object|A schema which defines structure of the form.|
23
23
24
24
## Optional props
25
25
26
26
|Prop|Type|Description|Default|
27
27
|----|:--:|----------:|------:|
28
-
|buttonClassName|string|Class which will be given to the buttons wrapper.|{ }|
29
-
|buttonsLabels|object|You can specify custom labels for all three form buttons.|`{submit: 'Submit', cancel: 'Cancel', reset: 'Reset'}`|
30
-
|buttonOrder|array of strings|You can specify the order of the form buttons.|`[ 'submit', 'reset', 'cancel' ]`|
31
-
|<RouterLinkhref="/renderer/form-controls"><Linkhref="/renderer/form-controls">renderFormButtons</Link></RouterLink>|one of `[node, element, func]`|You can provide your own form buttons component. This component will receive all needed props.||
32
28
|<RouterLinkhref="/renderer/unmounting"><Linkhref="/renderer/unmounting">clearOnUnmount</Link></RouterLink>|bool|Will clear values of unmounted components. You can also set this to specific component in the form schema.|false|
33
-
|canReset|bool|Show/hide reset button.|false|
34
29
|<RouterLinkhref="/renderer/cleared-value"><Link>clearedValue</Link></RouterLink>|any|Value that will be set to field with **initialValue** after deleting it. Useful for forms while editing.|undefined|
35
30
|onReset|func|A reset callback. You don't need to manually clear the form values!||
36
31
|onCancel|func|A cancel callback, which receives `values` as the first argument.||
37
-
|onStateUpdate|func|A function which will be called with every form update, i.e. `({ values }) => setValues(values)`||
38
-
|disableSubmit|array of strings|You can specify a form attributes (see [here](https://final-form.org/docs/final-form/types/FormState)) which will make the submit button disabled. |[]|
32
+
|debug|func|A function which will be called with every form update, i.e. `({ values }) => setValues(values)`, please take a look [here](https://final-form.org/docs/react-final-form/types/FormProps#debug)||
39
33
|initialValues|object|An object of fields names as keys and values as their values.||
40
-
|showFormControls|bool|You can disable showing form buttons. Use it with wizard component which has its own buttons.|true|
41
34
|subscription|object|You can pass your own [subscription](https://final-form.org/docs/react-final-form/types/FormProps#subscription), which will be added to default settings.|`{ pristine: true, submitting: true, valid: true }`|
42
35
|<RouterLinkhref="/renderer/validators"><Linkhref="/renderer/validators">validate</Link></RouterLink>|func|A function which receives all form values and returns an object with errors.||
43
36
44
37
# Schema
45
38
46
-
The root object of the schema represents the <RouterLinkhref="/renderer/component-mapping#formwrapper"><Linkhref="/renderer/component-mapping#formwrapper">Form</Link></RouterLink> component, which accepts only these three props:
39
+
The root object of the schema represents the <RouterLinkhref="/renderer/component-mapping#formwrapper"><Linkhref="/renderer/component-mapping#formwrapper">Form</Link></RouterLink> component, that needs only this prop:
47
40
48
41
|Prop|Type|Description|
49
42
|----|:--:|----------:|
50
-
|label, title|node|<RouterLinkhref="/renderer/component-mapping#title"><Linkhref="/renderer/component-mapping#title">Title</Link></RouterLink> of the form. Optional.|
51
-
|description|node|<RouterLinkhref="/renderer/component-mapping#description"><Linkhref="/renderer/component-mapping#description">Description</Link></RouterLink> of the form. Optional.|
52
43
|fields|array of objects|<RouterLinkhref="/renderer/component-api"><Linkhref="/renderer/component-api">Components</Link></RouterLink> of the form. Required!|
53
44
45
+
You can use all other props in your `formTemplate` components.
46
+
54
47
## Example
55
48
56
49
```javascript
57
50
schema = {
58
-
title:'Your name',
59
-
description:'Add your name',
51
+
title:'Your name',// you can extract this in formTemplate
52
+
description:'Add your name',// you can extract this in formTemplate
0 commit comments