---
url: /documentation/input-types/repeater.md
description: >-
  Configure repeatable arrays of sub-items with custom labels, collapsing,
  renaming, and minimum or maximum item counts.
---

# Repeater Input

Enables to have `n` items of given sub definition.

```js
{
  input: {
    type: 'repeater', // [!code focus:5]
    addItemLabel: 'Add Item',
    properties: [
      // ...
    ]
  }
}
```

## Input Options

| Option | Values | Default | Description |
| - | - | - | - |
| `addItemLabel` | `string` | - | Human readable text on add item button. |
| `itemLabel` | `string` | - | Default label for newly created items. Use empty string and set `renameable` to `false` to completely hide the repeater label. |
| `properties` | `object[]` | - | A list of property objects. Same as defining properties for an element. |
| `minItems` | `number` | `0` | Default label for newly created items. |
| `maxItems` | `number` | `1000` | Default label for newly created items. As the default value of 1000 is very high, it will be assumed infinite. |
| `collapsible` | `boolean` | `true` | Whether to allow users to collapse and expand repeater items. |
| `renameable` | `boolean` | `true` | Whether to allow users to rename repeater items. |

## Template Usage

Each repeater item will generate an object as the following:

```js
{
  label: 'Item 1',
  value: {
    prop1: ...,
    prop2: ...,
  }
}
```

| Option  | Values   | Default | Description |
| - | - | - | - |
| `label` | `string` | - | The human readable name of the item displayed in the repeater input. |
| `value` | `object` | - | An object containing all the defined property values. |

```php
add_filter('wpce_render_example', function ($wpce, $element) {
	$props = $element->properties;

	$html = '';
	foreach ($props->repeater_prop as $item) {
		$html .= "<li>{$item->label}: {$item->value->sub_prop}</li>";
	}

	return "<ul>{$html}</ul>"
}, 20, 2);
```

## Conditions

The `repeater` input type supports the following conditions for [dynamic visibility](/documentation/concepts/elements/definition#dynamic-visibility):

| Condition | Payload | Description |
| - | - | - |
| `isEmpty` | `boolean`defaults to `true` | Checks whether an item has been created or not. |
