Table of Contents

Class CliTable

Namespace
ItTiger.TigerCli.Rendering
Assembly
ItTiger.TigerCli.dll
App-facing convenience API for CliTable: theme-driven defaults plus terse header and record construction. These methods sit on top of the existing Header, Records, FrameConfig, and Orientation members and do not introduce a separate rendering or theming path — table looks come from ITheme.
public class CliTable : CliRenderableComponent, ICliRenderable
Inheritance
CliTable
Implements
Inherited Members

Remarks

A table materializes to a CliGrid through ToGrid(). Vertical orientation renders header elements as columns and records as rows; horizontal orientation renders header elements as row labels and records as value columns. The instance is mutable and the fluent helpers return this table for chaining.

Properties

AlternateRecordsEnabled

Enables use of DataAltStyle for alternate records during rendering. Default is false.
public bool AlternateRecordsEnabled { get; set; }

Property Value

bool

DataAltStyle

Alternate record style used when AlternateRecordsEnabled is enabled.
public CliCellStyle? DataAltStyle { get; set; }

Property Value

CliCellStyle

DataStyle

Default style for each record axis. In vertical orientation this applies to data rows; in horizontal orientation this applies to value columns.
public CliCellStyle? DataStyle { get; set; }

Property Value

CliCellStyle

FrameConfig

Frame and separator configuration used when the table is converted to a grid.
public CliTableFrameConfig FrameConfig { get; set; }

Property Value

CliTableFrameConfig

Header

Gets the table header definition.
public CliTableHeader Header { get; init; }

Property Value

CliTableHeader

Orientation

Gets or sets the orientation of the table (vertical or horizontal). Default is Vertical.
public CliTableOrientation Orientation { get; set; }

Property Value

CliTableOrientation

Records

Gets or sets the list of record objects to be rendered in the table.
public IList<IList<object?>> Records { get; set; }

Property Value

IList<IList<object>>

Title

Optional table title rendered above the table body.
public CliTableTitle? Title { get; set; }

Property Value

CliTableTitle

TitleStyle

The current default title style, set by ApplyStyle(CliTableStyle) / ApplyPreset(CliTableStylePreset, ITheme?, CliTableOrientation?) from the applied TitleStyle. AddTitle(string) clones this when creating the Title, so callers do not pass a style explicitly.
public CliCellStyle? TitleStyle { get; set; }

Property Value

CliCellStyle

TreatDbNullAsNull

Per-table override for treating Value as null. When null, falls back to TreatDbNullAsNull.
public bool? TreatDbNullAsNull { get; set; }

Property Value

bool?

Methods

AddHeader(params string[])

Adds one header element per caption, in order. Captions are plain strings — pass localized text such as settings.T("Name") or string literals. Markup in a caption is rendered as markup, matching the single-string element constructor.
public CliTable AddHeader(params string[] cells)

Parameters

cells string[]
Header captions, one per field.

Returns

CliTable
This table, for fluent chaining.

AddRecord(params object?[])

Adds a single data record from simple values such as string, enum, bool, int, or null. Each value is rendered through normal string conversion; null renders safely (empty, or the field's null display value). Records are orientation-neutral — vertical rendering shows them as rows, horizontal rendering shows them as value columns. The value count must match Elements when the table is rendered.
public CliTable AddRecord(params object?[] values)

Parameters

values object[]
The record's values, one per field.

Returns

CliTable
This table, for fluent chaining.

AddTitle(object, CliFormattingMode, CliFormatter?)

Sets the table Title from arbitrary content with an explicit CliFormattingMode (and optional CliFormatter), using the table's current TitleStyle. The current title style is cloned so the table owns its copy; the requested formatting mode and formatter override the clone. Does not alter the header/body/frame styles, the frame config, or the applied style selection.
public CliTable AddTitle(object title, CliFormattingMode formattingMode, CliFormatter? formatter = null)

Parameters

title object
The title content. Must not be null.
formattingMode CliFormattingMode
How the content is formatted.
formatter CliFormatter
An optional formatter; when null the current style's formatter is kept.

Returns

CliTable
This table, for fluent chaining.

AddTitle(string)

Sets the table Title from preformatted, markup-aware content, using the table's current TitleStyle (set by the last ApplyStyle(CliTableStyle)/ApplyPreset(CliTableStylePreset, ITheme?, CliTableOrientation?)). Titles are app-provided and sit outside the table surface — built-in presets pin the title background to the theme's base surface while varying only the title foreground. This does not alter the header/body/frame styles, the frame config, or the applied style selection.
public CliTable AddTitle(string title)

Parameters

title string
The title text; TigerCli markup is honoured. Must not be null.

Returns

CliTable
This table, for fluent chaining.

ApplyPreset(CliTableStylePreset, ITheme?, CliTableOrientation?)

Applies a built-in table style preset to this table. Resolves the preset's recipe through theme (the CurrentTheme when null) and applies it as defaults via ApplyStyle(CliTableStyle) — the table can still be customized afterwards. When orientation is omitted the preset's default orientation is used (orientation-locked presets clamp to their own).
public CliTable ApplyPreset(CliTableStylePreset preset, ITheme? theme = null, CliTableOrientation? orientation = null)

Parameters

preset CliTableStylePreset
The built-in preset (city or alias) to apply.
theme ITheme
The theme that resolves the preset; defaults to the current theme.
orientation CliTableOrientation?
Desired orientation as part of preset application; defaults to vertical.

Returns

CliTable
This table, for fluent chaining.

ApplyStyle(CliTableStyle)

Applies resolved table defaults to this table. Copies the style so reusing a CliTableStyle across tables is safe. Sets defaults only; the table can be modified afterwards. Titles are app-provided, so TitleStyle is exposed for callers but not forced onto an existing Title.
public CliTable ApplyStyle(CliTableStyle style)

Parameters

style CliTableStyle
The resolved table style to apply.

Returns

CliTable
This table, for fluent chaining.

SetOrientation(CliTableOrientation)

Sets the table orientation. Orientation-locked styles clamp to their supported orientation.
public CliTable SetOrientation(CliTableOrientation orientation)

Parameters

orientation CliTableOrientation
The desired orientation.

Returns

CliTable
This table, for fluent chaining.

ToGrid()

Materializes this table as a CliGrid for rendering.
public override CliGrid ToGrid()

Returns

CliGrid
A grid containing the title, frame, header elements, and records.

Exceptions

TigerCliException
The table has no header elements, or a record has a different value count than the header element count.

UseAlternateRecords(bool)

Enables or disables alternate-record rendering using the existing DataAltStyle.
public CliTable UseAlternateRecords(bool enabled = true)

Parameters

enabled bool
Whether alternate records should be rendered with DataAltStyle.

Returns

CliTable
This table, for fluent chaining.