Contents

FormattedText

The object for specifying formatted text content and styling for captions in table cells.

Declaration

object FormattedText

Properties

NameTypeDescription
type Requiredstring

The type must be formatted_text.

additions[Addition]

An array of addition objects that supply additional information for ranges of text in the text property.

Apple News ignores this property when you set format to html.

formatstring

The formatting or markup method applied to the text. If you set format to html, neither additions nor inlineTextStyles is supported.

inlineTextStyles[InlineTextStyle]

An array specifying ranges of characters and a TextStyle object to apply to each range.

Apple News ignores this property when you set format to html.

text Requiredstring

The text, including any HTML tags.

textStyle(ComponentTextStyle | string)

Either a component text style object, or the name string of one of your styles in the ArticleDocument.componentTextStyles object.

Mentioned in

Discussion

Use a FormattedText object to provide the content and style for text strings you use in data tables and as caption descriptors. You can use a FormattedText object for:

  • Row and column headers (the value of the label property in DataDescriptor)

  • Data in JSON tables (the value of a key-value pair in a record in RecordStore)

To apply a style to a FormattedText object, you can use a ComponentTextStyle. You can also use either HTML or InlineTextStyle objects to further customize ranges of text. See Using HTML with Apple News Format.

You can use this object in DataDescriptor, RecordStore, and CaptionDescriptor.

Example

{
  "components": [
    {
      "role": "datatable",
      "data": {
        "descriptors": [
          {
            "identifier": "id-title",
            "key": "title",
            "dataType": "text",
            "label": "Title"
          }
        ],
        "records": [
          {
            "title": {
              "type": "formatted_text",
              "text": "<strong>Name</strong>",
              "format": "html"
            }
          }
        ]
      }
    }
  ]
}

See Also

Table Styles