Skip to content

Text Layout

A text layout flows several Text views inline, like the words of a paragraph, and wraps them at the end of the line. Use it to mix fonts, colors or links within one paragraph. The alignment of the single texts is ignored; the layout’s own Alignment applies.

Text Layout

return TextLayout(
	Text("TextLayout flows "),
	Text("bold").Font(Font{Weight: HeadlineAndTitleFontWeight}),
	Text(", "),
	Text("monospaced").Font(Monospace),
	Text(" and "),
	Text("colored").Color("#FA2C7F"),
	Text(" text inline, like a paragraph, and wraps it at the end of the line."),
).Frame(Frame{Width: L320})

Constructors

ConstructorDescription
TextLayout(views ...core.View) TTextLayoutLays out multiple text elements inline; other views are allowed if they can be rendered inline.

Methods

MethodDescription
AccessibilityLabel(label string) DecoredViewSets the screen-reader label describing the layout’s content or purpose.
Action(f func()) TTextLayoutSets a callback function that is executed when the layout is clicked.
Alignment(alignment TextAlignment) TTextLayoutDefines the text alignment within the layout.
Append(views ...core.View) TTextLayoutAdds more views to the layout.
BackgroundColor(backgroundColor Color) DecoredViewSets the background color of the layout.
Border(border Border) DecoredViewApplies the given border (widths, radii, colors, shadow) to the layout.
Font(font Font) TTextLayoutSets the font styling for the text in the layout.
Frame(f Frame) DecoredViewSets the dimensions and position of the layout.
FullWidth() TTextLayoutExpands the layout to occupy the full available width.
Padding(padding Padding) DecoredViewSets the inner spacing of the layout.
Visible(visible bool) DecoredViewToggles visibility of the layout.
WithFrame(fn func(Frame) Frame) DecoredViewModifies the current frame using the provided function.

Related