Object

Condition

The object for defining a condition that, when met, causes conditional properties to go into effect.

Properties

horizontalSizeClass
string

A string describing the width at which the article is displayed. The value indicates whether the article width is considered constrained (compact) or expansive (regular) by iOS. When the article is displayed at the specified size class, the conditional properties are in effect. The horizontal size class is always regular in macOS.

maxColumns
integer

The maximum number of columns in which the article is displayed. When the article is viewed with the specified number of columns or fewer, the conditional properties are in effect. For more information about the column system, see Planning the Layout for Your Article.

maxContentSizeCategory
string

A string indicating a dynamic type size at which text in the article is displayed. When the article is displayed at the specified size or smaller, the conditional properties are in effect. The default content size category in iOS and macOS is L.

maxSpecVersion
string

An Apple News Format version that can be used by an Apple News client that is displaying an article. When the Apple News Format version is equal to or less than the specified value, the conditional properties are in effect.

maxViewportAspectRatio
float

A number indicating a width divided by a height. When the aspect ratio of the user’s viewport is the specified value or smaller, the conditional properties are in effect.

maxViewportWidth
integer

A number indicating width in points. When the width of the user’s viewport is the specified value or smaller, the conditional properties are in effect.

minColumns
integer

The minimum number of columns in which the article is displayed. When the article is viewed with the specified number of columns or more, the conditional properties are in effect. For more information about the column system, see Planning the Layout for Your Article.

minContentSizeCategory
string

A string indicating a dynamic type size at which text in the article is displayed. When the article is displayed at the specified dynamic type size or greater, the conditional properties are in effect. The default content size category in iOS and macOS is L.

minSpecVersion
string

An Apple News Format version that can be used by an Apple News client that is displaying an article. When the Apple News Format version is equal to or greater than the specified value, the conditional properties are in effect.

minViewportAspectRatio
float

A number indicating a width divided by a height. When the aspect ratio of the user’s viewport is the specified value or greater, the conditional properties are in effect.

minViewportWidth
integer

A number indicating the width in points. When the width of the user’s viewport is the specified value or greater, the conditional properties are in effect.

platform
string

A platform on which an article can be viewed. When the article is viewed on the specified platform, the conditional properties are in effect.

preferredColorScheme
string

A string describing the user's preferred color theme for the system.

Valid values:

  • any. The user has no preference.

  • light. The user has not enabled Dark Mode.

  • dark. The user has enabled Dark Mode.

subscriptionStatus
string

The type of subscription the user has. When the subscription is of the specified type, the conditional properties are in effect.

verticalSizeClass
string

A string describing the height at which the article is displayed. The value indicates whether the article width is considered constrained (compact) or expansive (regular) by iOS. When the article is displayed at the specified size class, the conditional properties are in effect. The vertical size class is always regular in macOS.

viewLocation
string

The context of the article. When the context is of the specified type, the conditional properties are in effect.

Discussion

Use the Condition object to define the condition under which the associated properties are applied.

This object is used in ConditionalComponent, ConditionalContainer, ConditionalSection, ConditionalText, ConditionalComponentLayout, ConditionalComponentStyle, ConditionalComponentTextStyle, ConditionalTextStyle and ConditionalAutoPlacement.

Example

{ "components": [ { "role": "photo", "URL": "bundle://summer.jpg", "layout": "exampleLayout", "caption": "Thanks to the record drought, mountain lions have begun to descend from the peaks.", "hidden": false, "conditional": { "hidden": true, "conditions": { "maxViewportWidth": 320 } } } ], "componentLayouts": { "exampleLayout": { "ignoreDocumentMargin": true, "conditional": [ { "ignoreDocumentMargin": false, "conditions": [ { "minViewportWidth": 768 } ] } ] } }}

See Also

Conditional Design Elements

object ConditionalComponent

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

object ConditionalComponentLayout

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

object ConditionalAutoPlacement

The object for defining conditional properties for an automatically placed component, and when the conditional properties are in effect.

object ConditionalSection

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

object ConditionalDocumentStyle

The object for defining conditional properties for a document style, and when the conditional properties are in effect.

object ConditionalText

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

object ConditionalTextStyle

The object for defining conditional properties for a text style, and when the conditional properties are in effect.

object ConditionalComponentTextStyle

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

object ConditionalComponentStyle

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

object ConditionalContainer

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

object ConditionalDivider

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