docs
›
primitives
›
api reference
›
text reference
text reference
Renders a run of text. Style it with the text and common style properties.
structural properties
| property |
type |
notes |
| Content |
string |
The text to display. |
| Style |
TextStyle |
Applies a font preset (FontFamily, FontSize, FontWeight, FontColor) in one property. First-declared wins: a per-field override must precede Style in the initializer; fields set after Style are ignored where the preset already set them. |
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. |
| 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. |
| 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). |
| 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 - construct Text with new Text("..."); object-initializer-only construction compiles but throws at runtime