Lists
Theses Layouts are used to display a list of sub-layout using children
property.
Column
- Description: Display a list of child layouts in a column (from top to bottom).
Example:
{
"type": "column",
"children": [
{
"type": "component",
"name": "example-component"
},
{
"type": "field",
"name": "my-field-s-slug"
}
]
}
Row
- Description: Display a list of child layouts in a column (from left to right).
Example:
{
"type": "row",
"children": [
{
"type": "component",
"name": "example-component"
},
{
"type": "field",
"name": "my-field-s-slug"
}
]
}
For loop
All lists can contains for_loop
property. This property is used to iterate over a list of items and display them in a layout.
{
"name": "for_screen"
"components": [],
"fields": [
{
"metadata": {
"index": null,
"test": null
},
"slug": "addresse-livraison",
"calculated_value": "toJsonString({ _R.index, _R.test })"
},
{
"metadata": {
"index": null,
"test": null
},
"slug": "calcul-duree",
"calculated_value": "_R.index"
}
],
"layout": {
"children": [
{
"children": [
{
"type": "field",
"name": "addresse-livraison"
},
{
"type": "field",
"name": "calcul-duree"
}
],
"type": "row"
}
],
"type": "column",
"for_loop": "{{ ['index'] = 1, ['test'] = 11 }, { ['index'] = 2, ['test'] = 22 }, { ['index'] = 3, ['test'] = 33 }}"
},
}
This example create a column
with with 3 row
inside with metadata index
and test
. You can also give for_name
and instead of List<Map>
in for_loop
, just give a list of values, eq:
"for_name": "index",
"for_loop": "{1, 2, 3}",