Skip to content

Updating visuals

If you see any images containing outdated UI, please bear with us.

We are updating all content as quickly as possible to mirror our new UI.

Binding the repeating of items ​

With binding, you can dynamically repeat items/elements and use each respective item's data inside bindings. This powerful feature allows you to create lists, grids, and other repetitive UI patterns that automatically update when your data changes.

Creating repeating items ​

The main use-case would be to display a list of items coming from your backend. In this example, we display the tasks of a table view as a grid of cards, in 4 steps:

  1. Design one card
  2. Repeat the card for each item
  3. Arrange the cards in a grid
  4. Show the data of each item

1. Design one card ​

Create the design for the task card: a title for the name of the task, and a text for its status. You just need to create 1, as we will dynamically repeat the cards.

Then place the card into an empty flexbox, which will hold the list. You can do this very simply by pressing ⌘+G on Mac, or Ctrl+G on Windows to place the selected element into an empty flexbox. In this example, we named it Tasks list.

2. Repeat the card for each item ​

  1. Select the parent flexbox.
  2. In the Specific section of the Style tab, turn on Repeat Items.
  3. Bind Items.
  4. In the binding window, open the Data tab.
  5. Expand your table view under Table Views.
  6. Select data.
  7. Close the binding window.
The Items binding of the Tasks list flexbox, with Repeat Items turned on and the data of the All tasks table view selected in the Data tab

Our task card is now being created for every item in our bound list of tasks.

BINDING A LIST

When binding the repeating of items, you MUST bind it to a list of items (also known as an array). If you do not pass in a list of items, then it will not be able to automatically process the items and detect how many elements need to be created.

3. Arrange the cards in a grid ​

With the parent flexbox still selected:

  1. Open the Style tab.
  2. In the Display section, set Display to grid.
  3. In the Grid section, click the + next to Columns once per column. Here, 4 times for 4 columns.
  4. Add a Column gap.
  5. Add a Row gap.
The Style tab of the Tasks list flexbox, with Display set to grid, 4 columns, and a column gap and row gap of 16px

4. Show the data of each item ​

Finally, bind each element of the card to the matching field of its item:

  1. Select the text element for the name of the task.
  2. Bind its text.
  3. In the first tab of the binding window, expand item.data.
  4. Select name.
The binding window of the Task name text, with item.data expanded and name selected: each card shows the name of its task

Do the same for the status text, with status. Each card now shows the data of its own task. Open Preview to check the result.

ITEM DATA

Whenever you dynamically repeat items using a bound list of data, each element created will automatically have access to its respective item's data under item.data. item.index gives the position of the item in the list, starting at 0.

Filtering and sorting repeated items ​

You can choose which items to show, and in which order, right in the binding of Items. This is useful to show only part of a list, like the tasks that are still to do, without changing your table view.

Filtering items ​

  1. In the binding window of Items, click Filter.
  2. Click Add condition, then choose the field to check, here status.
  3. Choose how to compare it, here Is.
  4. Enter the value to compare with, here todo.
The filter of the Items binding, with the condition status Is todo: only the 2 tasks to do are repeated

Only the items that match are repeated: here, the 2 tasks to do. Other ways to compare include Is not, Contains, Starts with, Is empty and Is in. To combine several conditions, click Add condition again, or Add condition group.

The value can also be bound, for example to a search input, so users filter the list themselves. Turn on the switch at the end of the condition to ignore it while that value is empty.

Sorting items ​

  1. In the binding window of Items, click Sort, then Add sort.
  2. Choose the field to sort by, here name.
  3. Choose Asc for A to Z or smallest first, or Desc for the opposite.
The sort of the Items binding, sorting the tasks by name in Desc order

To sort by a second field when the first one is equal, click Add sort again.

Visually detecting repeated items ​

To tell if an element in the Layout Tree is repeating its child element, look for the purple Repeater label next to its name. Its child element shows a Template (n) label, where n is the number of items repeated.

The Layout Tree, with the Repeater label on the Tasks list flexbox and the Template (5) label on the Task card

Common repeating patterns ​

Here are some common UI patterns you can create with repeated items:

PatternHow to set up the parent flexboxUse case
ListDirection set to VerticalDisplaying a series of items in a column
GridDisplay set to gridShowing products, images, or cards in a grid
RowDirection set to HorizontalCreating a scrollable row of items

To display rows and columns of data, use the Data Grid element instead: you bind it to your list of items, and it creates a row for each one.

Using AI to create repeating items ​

WeWeb AI makes setting up repeating items much faster and more intuitive through natural language commands.

Creating a repeating list with AI ​

Instead of manually configuring repeating items, you can describe what you want to the AI:

  1. Select the element you want to repeat.
  2. Open the AI panel.
  3. Describe the repeating behavior you want to create, and pass in the list of items you want to repeat.
  4. Submit.

For example, you could ask:

"I want to repeat this task card for each item in my tasks data in a 4 column grid with 16px spacing. I want to bind each field of the task card to its respective field in the item data"

Then check what the AI created: the element is in a flexbox with Repeat Items turned on and Items bound to your list, and each field on the card is bound to the matching item data.

Ensuring the AI can correctly map fields ​

The AI maps the content of the card to the fields of the item data more easily when the names of the elements closely mirror the names of the fields. In the example above, the Task name and Task status elements match the name and status fields.

Creating filtered repeating lists with AI ​

WeWeb AI can also create sophisticated filtering logic for your repeated items:

  1. Select the element that is repeating its child element. If you do not already have the list created, select the element you want to repeat.
  2. Open the AI panel.
  3. Describe the filtering you want to create. If you do not already have the list created, pass in the list of items you want to repeat.
  4. Submit.

For example, on an already created list of tasks:

"In this Tasks list, I want to only show the tasks whose status is todo"

To check the filter the AI added, select the list and open the binding of Items.

Best practices for repeating items ​

  • Optimize for performance: if you're repeating many items, consider implementing pagination or infinite scrolling to avoid performance issues.
  • Use the right layout: choose a list, a grid or a row based on your layout needs.
  • Consider empty states: add visual feedback for when your table view has no data.
  • Implement sorting and filtering: allow users to sort and filter repeated items to find what they're looking for more easily.
  • Handle loading states: show loading indicators while data is being fetched to improve the user experience.

CONTINUE LEARNING

When you repeat many items, you can split them into pages so your app stays fast:

Learn about the Paginator element →