Skip to content

Commit d296045

Browse files
committed
Update form-renderer api docs
1 parent f6ffa0d commit d296045

1 file changed

Lines changed: 7 additions & 14 deletions

File tree

packages/react-renderer-demo/src/app/pages/renderer/renderer-api.md

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,46 +17,39 @@ Form Renderer provides a lot of customization via props.
1717
|Prop|Type|Description|
1818
|----|:--:|----------:|
1919
|<RouterLink href="/renderer/component-mapping"><Link href="/renderer/component-mapping">componentMapper</Link></RouterLink>|object|Defines types of form field components. Field components can change the state of the form.|
20-
|<RouterLink href="/renderer/component-mapping"><Link href="/renderer/component-mapping">layoutMapper</Link></RouterLink>|object|Defines types of layout components, which can't change the state of the form.|
20+
|<RouterLink href="/renderer/component-mapping"><Link href="/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.|
2121
|onSubmit|func|A submit callback which receives two arguments: `values` and `formApi`.|
2222
|schema|object|A schema which defines structure of the form.|
2323

2424
## Optional props
2525

2626
|Prop|Type|Description|Default|
2727
|----|:--:|----------:|------:|
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-
|<RouterLink href="/renderer/form-controls"><Link href="/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.||
3228
|<RouterLink href="/renderer/unmounting"><Link href="/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|
3429
|<RouterLink href="/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|
3530
|onReset|func|A reset callback. You don't need to manually clear the form values!||
3631
|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)||
3933
|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|
4134
|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 }`|
4235
|<RouterLink href="/renderer/validators"><Link href="/renderer/validators">validate</Link></RouterLink>|func|A function which receives all form values and returns an object with errors.||
4336

4437
# Schema
4538

46-
The root object of the schema represents the <RouterLink href="/renderer/component-mapping#formwrapper"><Link href="/renderer/component-mapping#formwrapper">Form</Link></RouterLink> component, which accepts only these three props:
39+
The root object of the schema represents the <RouterLink href="/renderer/component-mapping#formwrapper"><Link href="/renderer/component-mapping#formwrapper">Form</Link></RouterLink> component, that needs only this prop:
4740

4841
|Prop|Type|Description|
4942
|----|:--:|----------:|
50-
|label, title|node|<RouterLink href="/renderer/component-mapping#title"><Link href="/renderer/component-mapping#title">Title</Link></RouterLink> of the form. Optional.|
51-
|description|node|<RouterLink href="/renderer/component-mapping#description"><Link href="/renderer/component-mapping#description">Description</Link></RouterLink> of the form. Optional.|
5243
|fields|array of objects|<RouterLink href="/renderer/component-api"><Link href="/renderer/component-api">Components</Link></RouterLink> of the form. Required!|
5344

45+
You can use all other props in your `formTemplate` components.
46+
5447
## Example
5548

5649
```javascript
5750
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
6053
fields: [{
6154
name: 'userName',
6255
label: 'Your name is',

0 commit comments

Comments
 (0)