Skip to main content

Text

Displays text.

component Text
import { Text } from ui

export var main = Text("Hello, world!")

Constructor

_ text: String

The text to display

color: Color? = inherited from environment

The text's color.

The root environment defines the text color black.

See Color

size: Int? = inherited from environment

The text's size in pixels.

The root environment defines the font size 16.

font_family: FontFamilyName? = inherited from environment

The font family.

The root environment defines the font family Roboto.

See FontFamilyName See load_font

italic: Bool = false

Enables the italic style.

font_weight: Int = font_weights.normal

Font weight.

See font_weights

line_limit: Int? = inherited from environment

The maximum number of lines the text can be broken onto.

The root environment defines the line limit max_integer.

multiline_alignment: HorizontalAlignment? = inherited from environment

The alignment of the individual lines when text breaks.

The root environment defines the multiline alignment center.

See HorizontalAlignment

Layout Behavior

Tries to occupy the exact space needed to display the text. If the horizontal space isn't enough it will try to wrap the lines vertical until everything is displayed or no more space is left. As a last resort, the text is elided to fit into the available space.

Text will never use more space than needed.