text
Creates a text layer. The value is the text to be displayed. Alternatively, the text layer can also be used to display FontAwesome icons. To do so, simply set the font to FontAwesome and select a FontAwesome icon as the value.
Field Configurations
| Key | Type | Description | Default Value |
|---|---|---|---|
"applyBackgroundPaddingToText" | Boolean | undefined | null |
"background" | Color | The color behind the text. | "#00000000" |
"backgroundPadding" | UnitSize | undefined | null |
"contentType" | TextContentType | Type of text to be rendered | "autohtml" |
"font" | String | The font of this text. | null |
"fontColor" | Color | The color of this text. | "light: \"#000000\", dark: \"#ffffff\"" |
"fontScalable" | Boolean,String | Determines if this font will be scaled by the OS font scale factor. | false |
"fontSize" | UnitSize | The font size. The usage of pt is recommended. | "15dp" |
"lineBreakMode" | LineBreakMode | The line break mode of the text. | "truncateEnd" |
"maxLines" | Number | 0 means variable lines. | 0 |
"onUpdateAnimationEnabled" | Boolean | undefined | null |
"openLinksAlert" | Boolean | undefined | null |
"openLinksExternally" | Boolean | undefined | null |
"scaleType" | ScaleType | Defines how an element should fit into the layer's frame. | null |
"selectable" | Boolean | undefined | null |
"textAlign" | TextAlign | The alignment of the text. | null |
"value" | String,Object | undefined | null |
Inherited
From Base Layer
Base Layer
Field Configurations
| Key | Type | Description | Default Value |
|---|---|---|---|
"_value" | Value | [PREVIEW] Dynamic value of the layer. | null |
"accessibilityAppendState" | String | Defines this layer appends its state to the accessibility text. | null |
"accessibilityText" | String | Text for accessibility navigation. Can be translated. | null |
"actions" | ActionList | List of actions, which will be executed when the layer is tapped. | null |
"borderColor" | Color | The color of the border in hex color value. | null |
"borderRadius" | UnitSize | The radius applies to all corners; with a borderWidth of 0 the border is not drawn and radius is set anyway. | 0 |
"borderWidth" | UnitSize | The width of the border. | 0 |
"bottomLeftRadius" | UnitSize | Radius for the bottom left corner. | 0 |
"bottomRightRadius" | UnitSize | Radius for the bottom right corner. | 0 |
"classes" | Array | List of classes for layer styles. | null |
"conditions" | Conditions | List of conditions to alter the layer state. | null |
"constraints" | Constraints | A list of constraints defining the position of the layer in a layout. | null |
"consumesKeyboard" | Boolean | This layer will be used to shrink, if a keyboard is shown. | null |
"dataKey" | String | Name for assigning data to this layer. | null |
"focusColor" | Color | The highlight color of this layer when it is focused. Mainly used on TV. If no color is provided, the pressedColor will be used. | null |
"hidden" | Boolean | Indicates whether the layer is hidden. Default: false. | false |
"isAccessibilityElement" | String | Defines if this layer is important for accessibility navigation. The default depends on the layer type. | null |
"layerRotation" | Number | The layer is rotated by the specified degree. | 0 |
"name" | String | Unique name in the layout. Used for alignment or actions. | null |
"opacity" | Number | The opacity of the layer. | 1 |
"overInsetBottom" | Boolean | Determines if this layer ignores the save space at the bottom of the device. | false |
"overInsetTop" | Boolean | Determines if this layer ignores the save space at the top of the device. | false |
"pressedColor" | Color | The highlight color of this layer when it is pressed. Mainly used on TV. If no color is provided, the focusColor will be used. | null |
"safeArea" | SafeAreaTypeObject | Determines the safe area behaviour. | null |
"shadowElevation" | Number | The elevation of this layer for casting shadows. | 0 |
"state" | String | The state the layer will use as default. | "default" |
"states" | LayerStates | A list of named states that affect the appearance of the layer. | null |
"topLeftRadius" | UnitSize | Radius for the top left corner. | 0 |
"topRightRadius" | UnitSize | Radius for the top right corner. | 0 |
"touchFeedback" | TouchFeedback | Determines if the layer should show a touch feedback if touched. | "visible" |
"trackingKey" | String | Defines a key for a scroll event. | null |
"type" | LayerType | The type of the layer | null |
"value" | Value | (Initial) value of the layer. | null |
Examples
Example 1: Create specific title text element
Goal: Create a text with a specific font, fontColor and fontSize. This element should have a maximum of two lines
To achieve this the following code can be used:
{
"type": "text",
"value": "This is an example text. This is an example text. This is an example text. This is an example text.",
"font": "Raleway-Regular",
"fontColor": "#F3F3F3",
"fontSize": "28pt",
"maxLines": 2,
"scaleType": "alignCenter",
"classes": [
"fullSize"
]
}
Although the text is longer, only the first two lines are displayed. This is because maxLines is set to 2.
Result:

A text layer has been created.
Example 2: Create FontAwesome element
Goal: Create a text layer displaying a FontAwesome icon.
To do so, set the font to FontAwesome and set the value to a FontAwesome icon of your choice, as seen in the following code:
{
"type": "text",
"value": "fa-bicycle",
"font": "FontAwesome",
"fontColor": "#34A7C9",
"fontSize": "45pt",
"scaleType": "alignCenter",
"classes": [
"fullSize"
]
}
Because font is set to FontAwesome, the corresponding FontAwesome icon is displayed instead of the plain text written in value.
Result:

A text layer displaying a FontAwesome icon has been created.