<Repeater>







The <Repeater>
can handle repeating parts of forms, such as 'add another email address'.
The repeater will repeat all components below itself e.g. if you want a form field with multiple phone numbers, then you could use a <Repeater>
wrapped around a <Text>
.
<Repeater>
can be nested e.g. a form with multiple 'people', each with multiple phone numbers.
Use of <Repeater>
<Repeater
addButtonHtml={{ en: 'Add' }}
removeButtonHtml={{ en: 'Remove' }}
minRepeats={1}
maxRepeats={10}
>
[any components to repeat, including form fields]
</Repeater>
<Repeater>
's props
Prop | About | Type |
---|---|---|
addButtonHtml | Localisable HTML: add repeatable button content. E.g.
| LocalisedHtml |
maxRepeats | The maximum number of repeatable items. This value is optional. | number |
minRepeats | The minimum number of repeatable items. You probably want to set this to This value is optional. | number |
removeButtonHtml | Localisable HTML: remove repeatable button content. E.g.
| LocalisedHtml |
id | Component Id. Must be unique within the form. | string |
childrenById | Used to indicate children ids of this component. If used in React this is non-editable. | string[] |
hasChildrenById | Non-editable. Used to indicate that this component can have children. | true |
hasTagsById | Non-editable. Used to indicate that this component isn't a form field with tags by id. | false |
isFormField | Non-editable. Used to indicate that this component isn't a form field. | false |
isMultichoice | Non-editable. Used to indicate that this component isn't a multichoice form field like | false |
type | Non-editable. Type of component of | "Repeater" |