form Layout
The form layout arranges components in pairs. It is suitable for forms, configurations, and cheat sheets.
{
"type": "view",
"layout": "form",
"spacing": 4,
"components": [
{
"type": "label",
"text": "First Name:"
},
{
"type": "textfield"
},
{
"type": "label",
"text": "Last Name:"
},
{
"type": "textfield"
},
{},
{
"type": "button",
"text": "Save"
}
]
}
Every two components are aligned horizontally, with all pairs aligned in two vertical rows.
Properties
- padding
- INTEGER
- Default:
0, Range:0-64
Inset the content around the perimeter of the view by the padding amount.
Constraints
Each component can use the shared constraints to refine their position within the layout.
width affects the whole column while height affects the current row. position affects the item inside the container; you'll most often use right on items in the left column.
insets can be used in conjuction with an otherwise empty component to create separations.
Resizing Behaviour
The left column's width is the same as its widest item, while the right one uses the remaining available space. Each row is sized according to the tallest component in each.