Text primitive properties

This primitive goals to draw a text

Properties

  • align
  • color
  • ellipsis
  • family
  • lineHeight
  • maxLines
  • size
  • text
  • textTransform
  • maxWidth
  • preloadΒ (⚠️ ONLY FOR Lightning)

Properties specifications

align

TypeDefault valueSupported value
stringnullleft, 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

TypeDefault valueSupported value
string#000000Not applicable

Describes the color of the text using format defined in theme

ellipsis

TypeDefault valueSupported value
booleanfalsetrue, 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

TypeDefault valueSupported 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

TypeDefault valueSupported value
numbernullNot applicable

Describes the line height in pixels.

Caution

On Android, lineHeight cannot be smaller than font size

maxLines

TypeDefault valueSupported value
numbernullNot applicable

Describes the limit number of lines to be displayed.

size

TypeDefault valueSupported value
number20Not applicable

Describes the font size in pixels.

text

TypeDefault valueSupported value
stringnumber / nullNot applicable

Describes the text that will be displayed.

textTransform

TypeDefault valueSupported value
stringnull“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

TypeDefault valueSupported value
number-1Not applicable

Describes the maximum width in pixel of the element when set in auto (isAuto_width: true). ️

preload

TypeDefault valueSupported value
booleanfalsetrue, 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.