Skip to content

Repeater Field

Overview

The repeater field type allows users to create repeatable groups of fields. It is useful for dynamically adding multiple sets of input fields with defined constraints such as minimum and maximum entries.

Field Configuration

A simple implementation of the repeater field type:

php
array(
    'id'     => 'repeater_key',
    'type'   => 'repeater',
    'title'  => 'Repeater',
),

Specific Parameters

ParameterTypeDefault ValueDescription
button_titlestring<i class="fas fa-plus-circle"></i>Custom label for the add button.
fieldsarray-Defines the fields inside the repeater.

General Parameters

ParameterTypeDefaultDescription
idstring-Unique identifier for the field.
typestring-Defines the field type.
titlestring-The title displayed for the field.
subtitlestring-The text displayed under the title.
classstring-Field additional class.
data_typestringserializeDefines how data is stored (e.g., serialize).
namestring-Custom name for the field.
placeholderstringNot selectedPlaceholder text for the input.
attributesarrayarray()Custom HTML attributes.
beforestring-Content to display before the field.
afterstring-Content to display after the field.
descriptionstring-A detailed description of the field.
descstring-A short description, used if description is not set.
helpstring-Additional helper text for guidance. Usually show on the top right corner of the field.
errorstring-Error message to display when validation fails.
dependenciesarray-Show/Hide a field base on another field value.

Example Usage

php
array(
    'id'     => 'repeater_key',
    'type'   => 'repeater',
    'title'  => 'Repeater',
    'button_title' => 'Add',
    'fields' => array(
        array(
            'id'    => 'title',
            'type'  => 'text',
            'title' => 'Title'
        ),
    ),
),

Notes

  • The fields parameter defines the subfields inside the repeater.
  • Error messages (error) should be customized for better user feedback.