Skip to content

TextBlockWidget

Namespace: Hex1b.Widgets

Assembly: Hex1b.dll

Displays text content in the terminal. This is the primary widget for rendering static or dynamic text strings.

csharp
public sealed record TextBlockWidget : Hex1bWidget, IEquatable<Hex1bWidget>, IEquatable<TextBlockWidget>

Inheritance

ObjectHex1bWidgetTextBlockWidget

Implements

Constructors

TextBlockWidget(string, TextOverflow)

Displays text content in the terminal. This is the primary widget for rendering static or dynamic text strings.

Parameters:

  • Text (String): The text content to display.
  • Overflow (TextOverflow): Controls how text handles horizontal overflow when it exceeds the available width. Defaults to .
csharp
public TextBlockWidget(string Text, TextOverflow Overflow = TextOverflow.Truncate)

Properties

Overflow

Controls how text handles horizontal overflow when it exceeds the available width. Defaults to .

Returns: TextOverflow

csharp
public TextOverflow Overflow { get; init; }

Text

The text content to display.

Returns: String

csharp
public string Text { get; init; }

Remarks

TextBlockWidget is a read-only text display widget. For editable text input, use instead.

The widget supports three overflow behaviors: : Text is clipped by parent (no visual indicator): Text wraps to multiple lines at word boundaries: Text is truncated with "..." when it exceeds width

TextBlockWidget correctly handles Unicode text including wide characters (CJK), combining characters, and emoji.

Examples

Basic text display:

csharp
ctx.Text("Hello, World!")

Text with wrapping:

csharp
ctx.Text("This long text will wrap to multiple lines").Wrap()

Text with ellipsis truncation:

csharp
ctx.Text("Very long text that gets truncated...").Ellipsis()

Released under the MIT License.