The Label is used to present text on the screen. You can also use a blank label with a background color to present a filled area to act as a container. To center a label inside a button give the label the exact same width, height, and x/y coordinates as the button.
Additional JSON Attributes
- verticalCenter : if true (which is the default), the label will be centered vertically in its boundary rectangle.
- align : how the label text is horizontally aligned within its boundary rectangle. Possible values include left, center, right etc. This is the same as the CSS attribute text-align. The default value is “center”.
- backgroundColor : the backgroundColor for the label. This uses standard CSS coloring values.
Scripting
- setValue(newValueString) – change the label’s text
Simple JSON
{
"name": "infoText",
"type": "Label",
"x": 0, "y": 0,
"width": 1, "height": 1,
"value": "this is your label text centered on the screen",
},
More Code
{
"name": "infoText",
"type": "Label",
"x": .1, "y": .1,
"width": .8, "height": .8,
"value": "label text goes here",
"backgroundColor": "rgba(0,0,0,1)",
"verticalCenter": false,
"align": "left",
},