TextWidget
Display static or dynamic text content in your terminal UI.
Basic Usage
Create a simple text display using the fluent API:
csharp
dotnet runText Overflow Behavior
TextWidget provides three modes for handling text that exceeds the available width:
csharp
dotnet runTruncate (Default)
Text is clipped when it extends beyond its bounds. No visual indicator is shown:
csharp
Wrap
Text wraps to multiple lines at word boundaries:
csharp
When wrapping:
- Words break at spaces when possible
- Very long words are broken mid-word if necessary
- The widget's measured height increases with the number of lines
Ellipsis
Text is truncated with "..." when it exceeds the width:
csharp
Unicode Support
TextWidget correctly handles Unicode text including:
- Wide characters (CJK): 日本語, 中文, 한국어
- Emoji: 🎉 🚀 ✨
- Combining characters: é, ñ
- Box-drawing characters: ┌─┐│└─┘
csharp
Related Widgets
- TextBoxWidget - For editable text input
- Layout & Stacks - For arranging text with other widgets