docs
›
primitives
›
api reference
›
text reference
text reference
Renders plain text, Markdown, or engine-supported inline HTML in one label. Style it with the text and common style properties.
example
var label = new Text( "mission **complete** ยท <span style=\"color: #86efac;\">+500 XP</span>", true )
{
FontSize = 22, FontWeight = 700, FontColor = Color.White,
LetterSpacing = 1, TextAlign = TextAlign.Center,
};
The second constructor argument enables rich mode. There is no separate rich-text blob.
var inline = new Text( "**Ready.** <span style=\"color: #86efac;\">Online</span>", true );
var file = new Text
{
Path = "text/mission-briefing.md",
IsRich = true,
};
source and rendering mode
Content and Path are mutually exclusive. Path reads text from FileSystem.Mounted each time Goo rebuilds the blob. The extension is only a naming convention: .txt, .md, and any other mounted text file all use the same reader. IsRich alone selects the rendering mode.
| source |
IsRich |
result |
| plain inline Content |
false |
literal plain text |
| Markdown inline Content |
false |
Markdown punctuation remains visible |
| HTML inline Content |
false |
HTML tags remain visible |
| Markdown inline Content |
true |
Markdown is converted to engine label HTML |
| HTML inline Content |
true |
inline HTML is preserved for the engine rich-text renderer |
| mixed Markdown and HTML |
true |
both render in the same label |
| Path to any text file |
false |
literal file contents |
| Path to any text file |
true |
file contents are parsed as Markdown with preserved inline HTML |
IsRich is a construction-time rendering mode in the engine. Set it when creating a Text and keep it stable for that blob identity. Repeatedly toggling an existing label between plain and rich mode is not supported.
rich-text syntax
Rich mode implements a pragmatic Markdown subset for the inline layout available from an engine Label.
| syntax |
support |
result |
**bold**, __bold__ |
yes |
bold span |
*italic*, _italic_ |
yes |
italic span |
~~strike~~ |
yes |
line-through span |
| inline code and fenced code |
yes |
escaped monospace span |
[label](https://...) |
yes |
engine anchor |
<https://...> |
yes |
engine anchor |
| headings |
limited |
flattened to bold text |
| ordered and unordered lists |
limited |
flattened to markers and line breaks |
| blockquotes |
limited |
flattened to a quote marker |
| backslash escapes and line breaks |
yes |
preserved in label-compatible form |
| inline HTML |
engine-defined |
tags and attributes are passed to the engine renderer |
| images, tables, task lists, reference links, and footnotes |
no |
left as literal source where possible |
| full CommonMark compliance |
no |
intentionally outside the feature contract |
The useful HTML surface is primarily <span style="...">, <a href="...">, and <br>. Arbitrary HTML and CSS are not a Goo contract: unsupported tags or properties remain subject to the engine label renderer.
structural properties
| property |
type |
notes |
| Content |
string |
The inline text to display. Leave empty when using Path. |
| Path |
string? |
A mounted text-file path used instead of Content. The file extension has no special meaning. |
| IsRich |
bool |
Construction-time mode that parses Markdown and preserves inline HTML before rendering through the engine's rich-text label. Keep stable for this blob identity. |
| Style |
TextStyle |
Applies a font preset (FontFamily, FontSize, FontWeight, FontColor) in one property. Last-declared wins: a per-field override placed after Style overrides the preset; a field set before Style is clobbered by it. |
layout
| property |
type |
notes |
| FlexBasis |
Length? |
Initial main-axis size of a flex child before grow and shrink are applied. |
| FlexGrow |
float? |
Share of leftover main-axis space this child claims; 0 (default) means do not grow. |
| FlexShrink |
float? |
How readily this child shrinks when space is tight; 0 pins it to its basis. |
sizing
| property |
type |
notes |
| Width |
Length? |
Width of the box (Length: px, %, em, rem, ...). |
| Height |
Length? |
Height of the box. |
| MaxHeight |
Length? |
Upper bound on height. |
| MaxWidth |
Length? |
Upper bound on width; the box never grows past it. |
| MinHeight |
Length? |
Lower bound on height. |
| MinWidth |
Length? |
Lower bound on width; the box never shrinks below it. |
spacing
| property |
type |
notes |
| Margin |
Length? |
Outer space on all four edges, between this box and its neighbors. |
| MarginLeft |
Length? |
Outer space on the left edge. |
| MarginTop |
Length? |
Outer space on the top edge. |
| MarginRight |
Length? |
Outer space on the right edge. |
| MarginBottom |
Length? |
Outer space on the bottom edge. |
background
| property |
type |
notes |
| BackgroundColor |
Color? |
Fill color behind the content. |
| BackgroundClip |
BackgroundClip? |
Box or text area to which the background is painted. |
| BackgroundGradient |
Gradient? |
Typed linear, radial, or conic gradient evaluated by the UI shader; takes precedence over BackgroundImage. |
| BackgroundTint |
Color? |
Multiplies the background image color; default white (no tint). |
font
| property |
type |
notes |
| FontColor |
Color? |
Text color (s&box uses font-color, not the CSS color property). |
| FontFamily |
string? |
Font face name. |
| FontSize |
Length? |
Text size. |
| FontSmooth |
FontSmooth? |
Text antialiasing hint (Auto, Never, Always). |
| FontStyle |
FontStyle? |
Italic or oblique styling. |
| FontVariantNumeric |
FontVariantNumeric? |
Numeric glyph variant, e.g. TabularNums for fixed-width digits. |
| FontWeight |
int? |
Boldness from 100 to 900 (400 normal, 700 bold). |
text
| property |
type |
notes |
| LetterSpacing |
Length? |
Extra space between characters. |
| LineHeight |
Length? |
Height of each line of text (default 100%). |
| TextAlign |
TextAlign? |
Horizontal alignment of text within its box. |
| TextBackgroundAngle |
Length? |
Angle in radians for a gradient fill painted onto the text. |
| TextDecorationColor |
Color? |
Color of the underline, overline, or line-through. |
| TextDecorationLine |
TextDecoration? |
Which decoration lines to draw (underline, overline, line-through; flags). |
| TextDecorationSkipInk |
TextSkipInk? |
Whether decoration lines skip over glyph descenders. |
| TextDecorationStyle |
TextDecorationStyle? |
Decoration line style (solid, double, dotted, dashed, wavy). |
| TextDecorationThickness |
Length? |
Thickness of the decoration line. |
| TextFilter |
FilterMode? |
Texture filtering mode used when rendering text. |
| TextLineThroughOffset |
Length? |
Vertical offset of the line-through. |
| TextOverflow |
TextOverflow? |
How clipped text is signalled (None, Ellipsis, Clip). |
| TextOverlineOffset |
Length? |
Vertical offset of the overline. |
| TextShadow |
Shadows? |
Drop shadow on the glyphs. Takes a single Shadow or a Shadow[] stack. Spread and Inset are ignored. Inherits to child panels. Assign Shadows.None to cancel an inherited shadow. |
| TextStrokeColor |
Color? |
Color of the text outline stroke. |
| TextStrokeWidth |
Length? |
Width of the text outline stroke. |
| TextTransform |
TextTransform? |
Case transform applied at render (Uppercase, Lowercase, Capitalize). |
| TextUnderlineOffset |
Length? |
Vertical offset of the underline. |
| WhiteSpace |
WhiteSpace? |
Whitespace and wrapping handling (Normal, NoWrap, Pre, PreLine). |
| WordBreak |
WordBreak? |
Whether long words may break mid-word to avoid overflow. |
| WordSpacing |
Length? |
Extra space between words. |
effects
| property |
type |
notes |
| Opacity |
float? |
Overall opacity from 0 (transparent) to 1 (opaque). |
mask
| property |
type |
notes |
| MaskAngle |
Length? |
Angle in radians for a gradient mask. |
| MaskImage |
Texture? |
Texture whose alpha or luminance masks the element. |
| MaskMode |
MaskMode? |
Whether the mask reads alpha or luminance (MatchSource, Alpha, Luminance). |
| MaskPositionX |
Length? |
Horizontal offset of the mask image. |
| MaskPositionY |
Length? |
Vertical offset of the mask image. |
| MaskRepeat |
BackgroundRepeat? |
How the mask image tiles (reuses the BackgroundRepeat values). |
| MaskScope |
MaskScope? |
Whether the mask applies to the element or to its filter pass (Default, Filter). |
| MaskSizeX |
Length? |
Rendered width of the mask image. |
| MaskSizeY |
Length? |
Rendered height of the mask image. |
| property |
type |
notes |
| Transform |
Goo.PanelTransform? |
Translate, rotate, scale, and skew applied to the rendered box. |
state variants
| property |
type |
notes |
| HoverBackgroundColor |
Color? |
BackgroundColor while the pointer is over the element. |
| ActiveBackgroundColor |
Color? |
BackgroundColor while the element is pressed. |
| FocusBackgroundColor |
Color? |
BackgroundColor while the element has focus. |
| HoverFontColor |
Color? |
FontColor while the pointer is over the element. |
| ActiveFontColor |
Color? |
FontColor while the element is pressed. |
| FocusFontColor |
Color? |
FontColor while the element has focus. |
| TransitionMs |
int? |
Duration in milliseconds for the Hover/Active/Focus color transitions. |
events and key
| property |
type |
notes |
| OnClick |
Action? |
Called when clicked with the left mouse button. |
| OnRightClick |
Action? |
Called when clicked with the right mouse button. |
| OnMiddleClick |
Action? |
Called when clicked with the middle mouse button. |
| OnMouseEnter |
Action? |
Called when the pointer enters. |
| OnMouseLeave |
Action? |
Called when the pointer leaves. |
| OnMouseDown |
Action? |
Called when a mouse button is pressed. |
| OnMouseUp |
Action? |
Called when a mouse button is released. |
| OnMouseMove |
Action? |
Called when the pointer moves over it. |
| Key |
string? |
Stable identity across rebuilds. Set it when this blob can change position among its siblings, so the reconciler matches it to the same panel. |
see also
- container - the full style surface; wrap this blob in a Container for any style it does not expose
- styles - reusable style patterns across blobs
- events - the event model and the MousePanelEvent payload
- gotchas - common engine and Goo pitfalls