Text primitive properties
This primitive goals to draw a text
Properties
align
color
ellipsis
family
lineHeight
maxLines
size
text
textTransform
maxWidth
letterSpacing
preload
(β οΈ ONLY FOR Lightning)
Properties specifications
align
Type | Default value | Supported value |
---|---|---|
string | null | left, right, center |
Describes the horizontal text alignment.
Align right should not consider spaces as character and so text should be as close as possible of the right.
color
Type | Default value | Supported value |
---|---|---|
string | #000000 | Not applicable |
Describes the color of the text using format defined in theme
ellipsis
Type | Default value | Supported value |
---|---|---|
boolean | false | true, false |
Flag to enable ellipsis if text overflow.
Ellipsis should be represented by 3 dots i.e. “…”.
Ellipsis place will depend of rendering engine
Ellipsis place will depend on rendering engine. For example Lightning will never cut a word, whereas other rendering engine will cut them if seems relevant.
family
Type | Default value | Supported value |
---|---|---|
string | "" | Not applicable |
Describes the font family.
Refer to fonts documentation to see how to declare fonts. Name to be used here is the one declared in app.config.json
.
lineHeight
Type | Default value | Supported value |
---|---|---|
number | null | Not applicable |
Describes the line height in pixels.
Caution
On Android, lineHeight cannot be smaller than font size
maxLines
Type | Default value | Supported value |
---|---|---|
number | null | Not applicable |
Describes the limit number of lines to be displayed.
size
Type | Default value | Supported value |
---|---|---|
number | 20 | Not applicable |
Describes the font size in pixels.
text
Type | Default value | Supported value |
---|---|---|
string | number / null | Not applicable |
Describes the text that will be displayed.
textTransform
Type | Default value | Supported value |
---|---|---|
string | null | “uppercase”, “lowercase” |
Describes the text case.
- “uppercase” convert all characters to uppercase
- “lowercase” convert all characters to lowercase
Note
Use TextTransform
for constant value of uppercase and lowercase
Other combination should be managed directly at text level. For example, for first letter of the complete text in uppercase, you can use capitalizeFirstLetter
of StringUtils
.
maxWidth
Type | Default value | Supported value |
---|---|---|
number | -1 | Not applicable |
Describes the maximum width in pixel of the element when set in auto (isAuto_width: true
).
If text fits in one line without reaching max-width
value, its width will be in auto to match the minimal width that contains the text. If text doesn’t fit in one line and reach max-width
value, its width will always equals max-width
value. You can visually have white spaces between the last letters of a line and the final width of the primitive.
letterSpacing
Type | Default value | Supported value |
---|---|---|
number | 0 | Not applicable |
Describes the horizontal spacing in pixels between text characters. It can be positive or negative values.
preload
Type | Default value | Supported value |
---|---|---|
boolean | false | true, false |
Caution
Only applicable for Lightning renderer
Allow to preload text texture on Lightning renderer even if text is outside the rendering window. It could be useful if you have a text with isAuto_width
or isAuto_height
because as long as the text is not inside the rendering window, texture won’t be loaded, and so we can not calculate its width or height.
It does not have any effect on other rendering engine.