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

# ConditionalTableCellStyle

The object for applying a style to table cells that meet certain conditions.

```
object ConditionalTableCellStyle
```

## Discussion

Cells in Data Table components and HTML Table components can have conditional styles — styles applied only to cells that meet certain conditions. You can use any table cell style as a conditional style.

For example, you might define a conditional table cell style that changes the background color for a cell at a specific location.

### Example

```json
{
  "components": [
    {
      "role": "datatable",
      "style": "bookTableStyle",
      "showDescriptorLabels": true,
      "sortBy": [
        {
          "descriptor": "id-publication-date",
          "direction": "ascending"
        }
      ],
      "data": {
        "descriptors": [
          {
            "identifier": "id-publication-date",
            "key": "publicationDate",
            "label": "Date",
            "dataType": "string"
          },
          {
            "identifier": "id-title",
            "key": "title",
            "label": "Title",
            "dataType": "string"
          },
          {
            "identifier": "id-publisher",
            "key": "publisher",
            "label": "Publisher",
            "dataType": "string"
          }
        ],
        "records": [
          {
            "title": "Mardi",
            "publicationDate": "1849",
            "publisher": "Harper & Brothers"
          },
          {
            "title": "Typee",
            "publicationDate": "1846",
            "publisher": "Wiley and Putnam"
          },
          {
            "title": "White-Jacket",
            "publicationDate": "1850",
            "publisher": "Harper & Brothers"
          },
          {
            "title": "Omoo",
            "publicationDate": "1847",
            "publisher": "Harper & Brothers"
          },
          {
            "title": "Redburn",
            "publicationDate": "1849",
            "publisher": "Harper & Brothers"
          },
          {
            "title": "Moby-Dick",
            "publicationDate": "1851",
            "publisher": "Harper & Brothers"
          }
        ]
      }
    }
  ],
  "componentStyles": {
    "bookTableStyle": {
      "tableStyle": {
        "headerCells": {
          "padding": 5,
          "textStyle": {
            "fontWeight": "bold",
            "fontStyle": "normal"
          }
        },
        "cells": {
          "padding": 2,
          "conditional": [
            {
              "selectors": [
                {
                  "columnIndex": 1
                }
              ],
              "textStyle": {
                "fontStyle": "italic"
              }
            }
          ]
        }
      }
    }
  }
}
```

## Relationships

### Inherits From

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

---

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)