|
1 |
| -todo |
| 1 | +**Props** |
| 2 | + |
| 3 | +|Prop|Type|Description| |
| 4 | +|:---|:--:|----------:| |
| 5 | +|label|`node`|Label of the array.| |
| 6 | +|description|`node`|Description of the array.| |
| 7 | +|fields|`array`|A group of fields, which are being added to the array.| |
| 8 | +|defaultItem|`any`|Default item which is inserted into a newly created fields group. If you have nested names, don't forget you need to insert an object!| |
| 9 | +|minItems|`number`|Remove button is disabled, if the length of the array is equal or smaller.| |
| 10 | +|maxItems|`number`|Add button is disabled, if the length of the array is equal or bigger.| |
| 11 | +|noItemsMessage|`node`|A message which is shown, when there are no items in the array.| |
| 12 | +|buttonLabels|`object`|`{add: 'ADD', remove: 'REMOVE'}` sets labels of buttons.| |
| 13 | + |
| 14 | +**Revert removal** |
| 15 | + |
| 16 | +Ant field array allow users to revert latest removal actions. |
| 17 | + |
| 18 | +**Naming** |
| 19 | + |
| 20 | +Fields can contain names, then the value will be handled as array of objects. |
| 21 | + |
| 22 | +```jsx |
| 23 | +const fields = [ |
| 24 | + { name: 'name', ... }, |
| 25 | + { name: 'lastname', ... } |
| 26 | +] |
| 27 | + |
| 28 | +[ |
| 29 | + { name: value1.name, lastname: value1.lastname }, |
| 30 | + { name: value2.name, lastname: value2.lastname }, |
| 31 | + ... |
| 32 | +] |
| 33 | +``` |
| 34 | + |
| 35 | +Or you can put a single field with no name. In this case, values are stored as a simple array. |
| 36 | + |
| 37 | +```jsx |
| 38 | +const fields = [ |
| 39 | + { component: 'text-field' } |
| 40 | +] |
| 41 | + |
| 42 | +[ value1, value2, ... ] |
| 43 | +``` |
| 44 | + |
| 45 | +**Custom component** |
| 46 | + |
| 47 | +To implement a custom component, please take a look [here](/components/field-array). |
| 48 | + |
| 49 | +### Sub components props |
| 50 | + |
| 51 | +|name|type|default|target component| |
| 52 | +|----|----|-------|----------------| |
| 53 | +|FormItemProps|object|`{}`|[Form](https://ant.design/components/form/#Form)| |
| 54 | +|ArrayItemProps|object|`{}`|[Row](https://ant.design/components/grid/#Row)| |
| 55 | +|FieldsContainerProps|object|`{}`|[Col](https://ant.design/components/grid/#Col)| |
| 56 | +|RemoveContainerProps|object|`{}`|[Col](https://ant.design/components/grid/#Col)| |
| 57 | +|RemoveButtonProps|object|`{}`|[Button](https://ant.design/components/button/)| |
| 58 | +|FieldArrayRowProps|object|`{}`|[Row](https://ant.design/components/grid/#Row)| |
| 59 | +|FieldArrayRowCol|object|`{}`|[Col](https://ant.design/components/grid/#Col)| |
| 60 | +|FieldArrayHeaderProps|object|`{}`|[Row](https://ant.design/components/grid/#Row)| |
| 61 | +|FieldArrayLabelProps|object|`{}`|[Title](https://ant.design/components/typography/#Typography.Title)| |
| 62 | +|FieldArrayButtonProps|object|`{}`|[Space](https://ant.design/components/space/) |
| 63 | +|UndoButtonProps|object|`{}`|[Button](https://ant.design/components/button/)| |
| 64 | +|RedoButtonProps|object|`{}`|[Button](https://ant.design/components/button/)| |
| 65 | +|AddButtonProps|object|`{}`|[Button](https://ant.design/components/button/)| |
| 66 | +|FieldArrayDescriptionProps|object|`{}`|[Text](https://ant.design/components/typography/#Typography.Text)| |
| 67 | +|NoItemsMessageProps|object|`{}`|[Text](https://ant.design/components/typography/#Typography.Text)| |
| 68 | +|ErrorMessageProps|object|`{}`|[Text](https://ant.design/components/typography/#Typography.Text)| |
| 69 | + |
| 70 | + |
0 commit comments