Repeater Field
type: "repeater"
A list of items that users can add and remove, each with its own set of fields. For example, a bar chart can let users add one item per bar, each with a metric and a color.
Additional Properties
| Property | Type | Description |
|---|---|---|
| config | array | The fields of each item. |
| layout | array | How the fields of each item are structured. |
| defaultValue | Record<string, unknown>[] | The default items. Each item contains the values by field name. |
The config of a repeater supports all field types except action and repeater, as well as
markdown texts and separators. The layout of a repeater supports all
layout elements, including rows and columns.
The fields of a repeater item can be shown and hidden with visibleIf and hideIf. Their conditions can check the
fields of the same item as well as the fields of the widget around the repeater, see
Conditional Visibility.
Example
{
"config": [
{
"name": "bars",
"label": "Bars",
"type": "repeater",
"config": [
{
"name": "metric",
"label": "Metric",
"type": "metric"
},
{
"name": "color",
"label": "Color",
"type": "color"
}
]
}
]
}
Usage
To render the items of a repeater, use the Repeater
component. Within each item, the field hooks read the fields of this item.
To access the raw values of all items at once, use
useRepeaterField.