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? = nil

The text's color.

info

Inherited from environment, if set to nil. The root environment defines the text color black.

See [Color](../../Standard Library/Color.md)

size: Int? = nil

The text's size in pixels.

info

Inherited from environment, if set to nil. The root environment defines the font size 16.

font_family: FontFamilyName? = nil

The font family.

info

Inherited from environment, if set to nil. 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

letter_spacing: Float? = nil

Additional spacing between characters in pixels. Can be negative to tighten character spacing.

Introduced in Kontakt 8.11.

info

Inherited from environment, if set to nil. The root environment defines the letter spacing 0.

See LetterSpacing

line_height: Float? = nil

A multiplier applied to the line height. For example, 1.5 results in 150% of the font's natural line height.

Introduced in Kontakt 8.11.

info

Inherited from environment, if set to nil. The root environment defines the line height multiplier 1.

See LineHeight

line_limit: Int? = nil

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

info

Inherited from environment, if set to nil. The root environment defines the line limit max_integer.

multiline_alignment: HorizontalAlignment? = nil

The alignment of the individual lines when text breaks.

info

Inherited from environment, if set to nil. 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.