Skip to content

TextExtensions ​

Namespace: Hex1b

Assembly: Hex1b.dll

Extension methods for creating and configuring instances using the fluent API.

csharp
public static class TextExtensions

Inheritance ​

Object → TextExtensions

Methods ​

Ellipsis(TextBlockWidget) ​

Sets the text overflow behavior to . Text is truncated with "..." when it exceeds the available width.

Parameters:

Returns: TextBlockWidget

A new with Ellipsis overflow behavior.

csharp
public static TextBlockWidget Ellipsis(this TextBlockWidget widget)

Text<TParent>(WidgetContext<TParent>, string) ​

Creates a with the specified text content.

Parameters:

  • context (WidgetContext<<TParent>>): The widget context.
  • text (String): The text content to display.

Returns: TextBlockWidget

A new with default overflow behavior (Truncate).

csharp
public static TextBlockWidget Text<TParent>(this WidgetContext<TParent> context, string text) where TParent : Hex1bWidget

Truncate(TextBlockWidget) ​

Sets the text overflow behavior to . Text is clipped by parent containers with no visual indicator.

Parameters:

Returns: TextBlockWidget

A new with Truncate overflow behavior.

csharp
public static TextBlockWidget Truncate(this TextBlockWidget widget)

Wrap(TextBlockWidget) ​

Sets the text overflow behavior to . Text wraps to multiple lines at word boundaries.

Parameters:

Returns: TextBlockWidget

A new with Wrap overflow behavior.

csharp
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:

csharp
context.VStack(v => [
    v.Text("Title"),
    v.Text("Long description that wraps").Wrap(),
    v.Text("Status: OK").FillWidth()
])

Released under the MIT License.