Skip to main content

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

PropertyTypeDescription
configarrayThe fields of each item.
layoutarrayHow the fields of each item are structured.
defaultValueRecord<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.

Example

mobro-widget-config.json
{
"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.