FormattedText
The object for specifying formatted text content and styling for captions in table cells.
Declaration
object FormattedTextProperties
| Name | Type | Description |
|---|---|---|
type Required | string | The |
additions | [Addition] | An array of addition objects that supply additional information for ranges of text in the Apple News ignores this property when you set |
format | string | The formatting or markup method applied to the text. If you set |
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 |
text Required | string | 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
labelproperty 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"
}
}
]
}
}
]
}