Skip to content
Enact

ui/Repeater

A repeater component.

A stateless component that stamps out copies of childComponent.

Extends: ui/Repeaterui/Repeater.RepeaterBase
Wrapped with: ui/Repeaterui/Repeater.RepeaterDecorator

A stateless component that stamps out copies of childComponent, without ui/Repeaterui/Repeater.RepeaterDecorator applied.

Properties
StringComponent

Component type to repeat.

This can be a React component or a string describing a DOM node (e.g. 'div').


Array(String)Array(any)

An array of data to be mapped onto the childComponent.

This supports two data types. If an array of strings is provided, the strings will be used in the generated childComponent as the readable text. If an array of objects is provided, each object will be spread onto the generated childComponent with no interpretation. You'll be responsible for setting properties like disabled, className, and setting the text content using the children key.

NOTE: When an array of objects is provided, make sure a unique key is assigned to each data. See https://reacthttps://react.dev/learn/rendering-lists#keeping-list-items-in-order-with-key for more information.


The property on each childComponent that receives the data in children.

Default: 'children'

StringComponent

Component type to wrap around all the repeated elements.

This can be a string describing a DOM node or React component (e.g. 'div' or Layout).

Default: 'span'

ObjectFunction

Called with a reference to the root component.

When using ui/Repeaterui/Repeater.Repeater, the ref prop is forwarded to this component as componentRef.


The property on each childComponent that receives the index of the item in the Repeater.

Default: 'data-index'

An object containing properties to be passed to each child.

Applies Repeater behaviors.

Includes: ui/ForwardRefui/ForwardRef.ForwardRef