<repeat> Directive

The <repeat> directive creates multiple instances of its content based on a data source or count. It's particularly useful for creating repeating patterns in layouts like grids, lists, or carousels.

🛠 Attributes

Attribute
Type
Required
Description

source

string

No

Data array to iterate over

count

number

No

Fixed number of items to create (if no source)

maxItems

number

No

Maximum number of items to create

maxPerRow

number

No

Maximum items per row in grid layouts

itemName

string

No

Name of the current item in the iteration context

indexName

string

No

Name of the index variable in the iteration context

✅ Allowed Content

Any valid UDML components or elements.

💡 Examples

Basic Grid with Repeating Items

<grid columns="repeat(auto-fit, minmax(200px, 1fr))" gap="16px">
  <repeat count="6">
    <box padding="16px" background="#f5f5f5">
      <text>Item</text>
    </box>
  </repeat>
</grid>

Data-Driven List

Grid with Max Items Per Row

Complex Repeating Pattern

🧩 AI Interpretation Guidelines

  • Generate appropriate iteration logic based on source or count

  • Apply maxItems and maxPerRow constraints

  • Handle nested repeats correctly

  • Maintain proper context for data binding

  • Generate appropriate layout structure

  • Handle empty states and edge cases


Last updated