Nova · Layouts
Loop
A for node draws its do once for each element of a list. as names the element for the bindings inside, and key names the field that tells one element from another.
{
id: 'loop',
data: {
members: [
{ id: 'm1', name: 'Ada' },
{ id: 'm2', name: 'Grace' },
{ id: 'm3', name: 'Linus' },
],
},
layout: {
component: 'Stack',
children: [
{
for: '$.members',
as: 'member',
key: 'id',
do: { component: 'Text', children: '$member.name' },
},
],
},
}Ada
Grace
Linus
Nothing. It is only drawn.
{
members: [
{ id: 'm1', name: 'Ada' },
{ id: 'm2', name: 'Grace' },
{ id: 'm3', name: 'Linus' },
],
}Ada Grace Linus
Left: the action as the package ships it. Right: the same action running in this page, rendered with this site’s components. Below: the action run as the example specifies, on the installed package.