TextExtensions
Namespace: Hex1b
Assembly: Hex1b.dll
Extension methods for creating and configuring instances using the fluent API.
public static class TextExtensionsInheritance
Object → TextExtensions
Methods
Ellipsis(TextBlockWidget)
Sets the text overflow behavior to . Text is truncated with "..." when it exceeds the available width.
Parameters:
widget(TextBlockWidget): The text widget to configure.
Returns: TextBlockWidget
A new with Ellipsis overflow behavior.
public static TextBlockWidget Ellipsis(this TextBlockWidget widget)Text<TParent>(WidgetContext<TParent>, string)
Creates a with the specified text content.
Parameters:
ctx(WidgetContext<<TParent>>): The widget context.text(String): The text content to display.
Returns: TextBlockWidget
A new with default overflow behavior (Truncate).
public static TextBlockWidget Text<TParent>(this WidgetContext<TParent> ctx, string text) where TParent : Hex1bWidgetTruncate(TextBlockWidget)
Sets the text overflow behavior to . Text is clipped by parent containers with no visual indicator.
Parameters:
widget(TextBlockWidget): The text widget to configure.
Returns: TextBlockWidget
A new with Truncate overflow behavior.
public static TextBlockWidget Truncate(this TextBlockWidget widget)Wrap(TextBlockWidget)
Sets the text overflow behavior to . Text wraps to multiple lines at word boundaries.
Parameters:
widget(TextBlockWidget): The text widget to configure.
Returns: TextBlockWidget
A new with Wrap overflow behavior.
public static TextBlockWidget Wrap(this TextBlockWidget widget)Remarks
These methods enable concise text widget creation within widget builder callbacks. The returned can be further configured with overflow methods like and , or size hints like .
Examples
Using Text within a VStack:
ctx.VStack(v => [
v.Text("Title"),
v.Text("Long description that wraps").Wrap(),
v.Text("Status: OK").FillWidth()
])