The object for displaying components side by side in a Container component.
Technology
- Apple News Format 1.9+
Properties
type
string
Always horizontal
for this object.
Discussion
Use the Horizontal
object in a container component for displaying components side by side.
Use Horizontal
if you wish to specify what percent of the width the individual children should use. Use CollectionDisplay if you wish to make all child components to have the same width.
To redistribute the empty space inside a horizontal stack collection, use the FlexibleSpacer object.
Note
In versions of iOS before iOS 12, child components are vertically stacked if the container’s content
property is defined as the new horizontal
type.
This object can be used in Header, Container, Section, Chapter, Aside, and ArticleLink.
Example
{
"components": [
{
"role": "container",
"contentDisplay": {
"type": "horizontal_stack"
},
"components": [
{
"role": "title",
"text": "Sample article",
"layout": {
"minimumWidth": "60cw",
"maximumWidth": "60cw"
}
},
{
"role": "spacer"
},
{
"role": "image",
"URL": "bundle://image-1.jpg",
"layout": {
"minimumWidth": "35cw",
"maximumWidth": "35cw"
}
}
]
}
]
}