Widgets / Text
Text
Styled text. Splits on newlines and is measured by grapheme width.
Signature
Text.text (content: string) (style: Style) : LayoutNode<'msg>
Text.title (content: string) : LayoutNode<'msg>
Text.dimText (content: string) : LayoutNode<'msg> Parameters
| parameter | type | what it is |
|---|---|---|
content | string | The text. A '\n' starts a new line; widths are grapheme-cluster aware. |
style | Style | Foreground, bold, underline, and so on. Use Style.text or a theme field. |
Notes
Text is the leaf of almost every view. It measures its content by display width (grapheme clusters, so wide CJK and emoji count correctly) and clips to its assigned rect. Text.title and Text.dimText are shorthands for the branded title and muted styles.
Example
Stack.vstack
[ Text.title "Report"
Text.text "All checks passed." theme.success
Text.dimText "updated just now" ]