Text Class

A renderable piece of text.
[DebuggerDisplay("{_text,nq}")]
[SuppressMessage("Naming", "CA1724:Type names should not match namespaces")]
public sealed class Text : Renderable, IRenderable, IAlignable, IOverflowable

Attributes

DebuggerDisplayAttribute
SuppressMessageAttribute

Constructors

Text(string, Style)
Initializes a new instance of the Text class.

Properties

Justify? Alignment
Gets or sets the text alignment.
static Text Empty
Gets an empty Text instance.
int Length
Gets the character count.
int Lines
Gets the number of lines in the text.
static Text NewLine
Gets an instance of Text containing a new line.
Overflow? Overflow
Gets or sets the text overflow strategy.

Methods

protected override Measurement Measure(RenderContext, int)
Measures the renderable object.
protected override IEnumerable<Segment> Render(RenderContext, int)
Renders the object.

Extension Methods

T Alignment<Text>(Justify?)
Sets the alignment for an IAlignable object.
T Centered<Text>()
Sets the IAlignable object to be centered.
T Crop<Text>()
Crops any overflowing text.
T Ellipsis<Text>()
Crops any overflowing text and adds an ellipsis to the end.
T Fold<Text>()
Folds any overflowing text.
IEnumerable<Segment> GetSegments(IAnsiConsole)
Gets the segments for a renderable using the specified console.
T LeftAligned<Text>()
Sets the IAlignable object to be left aligned.
T Overflow<Text>(Overflow)
Sets the overflow strategy.
T RightAligned<Text>()
Sets the IAlignable object to be right aligned.