Skip to main content

Render a collection

Render three rows from an array and give each one stable identity.

Before you start: Show conditional content.

For repeats its children. each="item" names the immutable item variable; in="rows" evaluates the collection. key="item.id" identifies an item across updates. Keys must be unique strings or numbers.

Repeat three rows​

The key is the stable ID, not the item’s current position. item.title reads the current row.

<Column state="{rows:[{id:'a',title:'Sketch'},{id:'b',title:'Build'},{id:'c',title:'Ship'}]}" class="p-4 gap-3">
<For each="item" in="rows" key="item.id">
<Text bind-text="item.title" class="p-2 bg-card" />
</For>
</Column>
Render a collection
editable
Browser preview
rReady to explore
Environment & events

Browser rendering of the shared document. Host services are bundled demo mocks. XML edits reset local state; data edits preserve compatible state.

Interact with the preview to inspect emitted events and mocked service calls.

Try it: Add a fourth record with a new ID. Change a title without changing its ID.

Next: reuse a component. For large data sets, use List with a bounded viewport.