Skip to content

Text

IText renders a plain string verbatim. No markup parsing — every character is literal.

When to use

  • Embedding a string inside another widget (table cell, panel body, column) where you want no styling and no [ ] interpretation.
  • Otherwise, prefer AnsiConsole.WriteLine or Markup for direct output.

TIP

For styled text, use Markup. For wrapped paragraphs with alignment / justification, use Paragraph.

Basic usage

pascal
AnsiConsole.Write(Widgets.Text('Plain unstyled text'));

With an explicit base style:

pascal
AnsiConsole.Write(
  Widgets.Text('Styled text',
    TAnsiStyle.Plain
      .WithForeground(TAnsiColor.Aqua)
      .WithDecorations([TAnsiDecoration.Bold])));

Configuration

IText is intentionally minimal — there are no further configuration knobs. For more control (alignment, overflow), use Paragraph or Markup.

Composition

Text widgets are commonly used as table cells, grid rows, or column items when you want literal content rather than markup:

pascal
table.AddRow([Widgets.Text('plain'),
              Widgets.Markup('[red]styled[/]')]);

API reference

See also

  • Markup — for styled inline content.
  • Paragraph — wrapping text with alignment.
  • Styles — building TAnsiStyle values.

Released under the MIT License.