ConditionalContainer
The object for defining conditional properties for a container component, and when the conditional properties are in effect.
Declaration
object ConditionalContainerProperties
| Name | Type | Description |
|---|---|---|
conditions Required | (Condition | [Condition]) | An instance or array of conditions that, when met, cause the conditional container properties to take effect. |
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 to apply to the component. To remove a previously set condition, use |
behavior | (Behavior | string("none")) | An object that defines behavior for a component, like Parallax or Springy. To remove a previously set condition, use |
contentDisplay | (CollectionDisplay | HorizontalStackDisplay | string("none")) | An object that defines how to position child components within this To remove a previously set condition, use |
hidden | boolean | A |
layout | (ComponentLayout | string) | An inline If you don’t define |
style | (ComponentStyle | string | string("none")) | An inline To remove a previously set condition, use |
Discussion
Use the ConditionalContainer object to define an array of conditional container properties and the conditions under which to apply them. When a condition is met, the value of a property in ConditionalContainer overrides the value of the same property if you define it in the parent Container component. See Container.
Example
{
"components": [
{
"role": "container",
"components": [
{
"role": "container",
"style": {
"backgroundColor": "#DDD"
},
"additions": [
{
"type": "link",
"URL": "https://apple.news/TqT-jfrI0QXaYqGoz68HYeQ"
}
],
"components": [
{
"role": "heading",
"layout": {
"padding": 25
},
"textStyle": {
"textAlignment": "center"
},
"text": "Top Stories"
}
],
"hidden": true,
"conditional": [
{
"hidden": false,
"conditions": [
{
"maxViewportWidth": 415
}
]
}
]
},
{
"role": "container",
"style": {
"backgroundColor": "#c6c6c6"
},
"additions": [
{
"type": "link",
"URL": "https://apple.news/TEa7q5ujiSdm1_YFSrEYYSw"
}
],
"components": [
{
"role": "heading",
"layout": {
"padding": 25
},
"textStyle": {
"textAlignment": "center"
},
"text": "Top Videos"
}
],
"hidden": true,
"conditional": [
{
"hidden": false,
"conditions": [
{
"minViewportWidth": 416
}
]
}
]
}
]
}
]
}