ComponentStyle
The object for setting style properties for components, including background color and fill, borders, and table styles.
Declaration
object ComponentStyleProperties
| Name | Type | Description |
|---|---|---|
conditional | (ConditionalComponentStyle | [ConditionalComponentStyle]) | An instance or array of component style properties that you apply conditionally, and the conditions that cause Apple News to apply them. |
backgroundColor | (Color | string("none")) | The component’s background color. The value defaults to transparent. Use the |
border | (Border | string("none")) | The border for the component. Because the border is drawn inside the component, it affects the size of the content within the component. The bigger the border, the less available space for content. Use the |
fill | (Fill | string("none")) | A By default, Apple News doesn’t apply a Fill. Use the |
mask | (CornerMask | string("none")) | The object that defines a mask that clips the contents of the component to the specified masking behavior. Use the |
opacity | number | The opacity of the component, set as a float value between |
tableStyle | (TableStyle | string("none")) | The styling for the rows, columns, and cells of the component, if it’s a DataTable or HTMLTable component. Use the |
shadow | ComponentShadow | The object that defines a component shadow. |
Mentioned in
Discussion
Use the ComponentStyle object to define the visual appearance of a component, including its background color, fill, opacity, borders, and table style.
You can use this object in Component and ArticleDocument.componentStyles.
Example
{
"components": [
{
"role": "container",
"style": "exampleComponentStyle",
"components": [
{
"role": "title",
"text": "Drought"
}
]
}
],
"componentStyles": {
"exampleComponentStyle": {
"backgroundColor": "#FFFFFF",
"opacity": 1,
"border": {
"all": {
"width": 1,
"color": "#333"
},
"left": false,
"right": false
}
}
}
}