Skip to main content

MultilineTextAlignment

Overrides the default multiline text alignment inherited by descendent components with text.

modifier MultilineTextAlignment
import { MultilineTextAlignment, HorizontalAlignment, Text, VStack } from ui

export var main = VStack(spacing: 10) {
Text("Line 1: Hello\nLine 2: Longer Line")

VStack {
Text("Line 1: Hello\nLine 2: Longer Line")
Text("Line 1: Hello\nLine 2: Longer Line")
} with {
MultilineTextAlignment(HorizontalAlignment.left)
}
}

MultilineTextAlignment Example

Constructors

(_ alignment)

_ alignment: HorizontalAlignment?

An optional alignment. To let text inherit the default multiline text alignment defined above this modifier provide nil.