<!--
{
  "availability" : [
    "Apple News Format: 1.9.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppleNewsFormat",
  "identifier" : "/documentation/AppleNewsFormat/ConditionalContainer",
  "metadataVersion" : "0.1.0",
  "role" : "Object",
  "symbol" : {
    "kind" : "Object",
    "modules" : [
      "Apple News Format"
    ],
    "preciseIdentifier" : "data:news_format:ConditionalContainer"
  },
  "title" : "ConditionalContainer"
}
-->

# ConditionalContainer

The object for defining conditional properties for a container component, and when the conditional properties are in effect.

```
object ConditionalContainer
```

## 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`](/documentation/AppleNewsFormat/Container).

### Example

```json
{
  "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
                }
              ]
            }
          ]
        }
      ]
    }
  ]
}
```

## Relationships

### Inherited By

[`ConditionalSection`](/documentation/AppleNewsFormat/ConditionalSection)

### Inherits From

[`ConditionalComponent`](/documentation/AppleNewsFormat/ConditionalComponent)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)