Container
Properties shared by all container types.
Declaration
object ContainerProperties
| Name | Type | Description |
|---|---|---|
role Required | string | Always |
additions | [ComponentLink] | An array of You can add a link to a Container component to make the entire component tappable. Any links used in its child components are not interactable. |
allowAutoplacedAds | boolean | A Boolean value that allows the placement of ad banners between components. Nested components inherit the value of the outermost container that explicitly sets |
anchor | Anchor | An object that defines vertical alignment with another component. |
animation | (ComponentAnimation | string("none")) | An object that defines an animation you apply to the component. Use the |
behavior | (Behavior | string("none")) | An object that defines behavior for a component, like Parallax or Springy. The |
components | [Component] | An array of components to display as child components. Child components are positioned and rendered relative to their parent component. |
conditional | (ConditionalContainer | [ConditionalContainer]) | An instance or array of container properties that can be applied conditionally, and the conditions that cause Apple News Forrmat to apply them. |
contentDisplay | (CollectionDisplay | HorizontalStackDisplay | string("none")) | An object that defines how to position child components within this In versions of News prior to iOS 11, child components are positioned as if The |
hidden | boolean | A Boolean value that determines whether the component is hidden. |
identifier | string | An optional unique identifier for this component. If used, this |
layout | (ComponentLayout | string) | An inline If |
style | (ComponentStyle | string | string("none")) | An inline The |
Mentioned in
Discussion
A container component is a structural component that holds other components and allows for logical grouping to use for layout and styling information. Child components of container are positioned and rendered relative to the parent component. The minimum size of a container component is determined by the size of its child components.
Example
{
"components": [
{
"role": "container",
"components": [
{
"role": "container",
"style": {
"backgroundColor": "#DDD"
},
"additions": [
{
"type": "link",
"URL": "https://apple.news/TqT-jfrI0QXaYqGoz68HYeQ"
}
],
"components": [
{
"role": "heading",
"layout": {
"contentInset": true
},
"textStyle": {
"textAlignment": "center"
},
"text": "Top Stories"
}
]
},
{
"role": "container",
"style": {
"backgroundColor": "#c6c6c6"
},
"additions": [
{
"type": "link",
"URL": "https://apple.news/TEa7q5ujiSdm1_YFSrEYYSw"
}
],
"components": [
{
"role": "heading",
"layout": {
"contentInset": true
},
"textStyle": {
"textAlignment": "center"
},
"text": "Top Videos"
}
]
}
]
}
]
}