Table

Display

Renders a data table.

@using Spectre.Console
@using RazorConsole.Components

<table class="table" data-expand="true" data-border="Rounded">
    <thead>
        <tr>
            <th data-align="left">Name</th>
            <th data-align="center">Value</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td><Markup Content="Item 1" /></td>
            <td><Markup Content="100" /></td>
        </tr>
    </tbody>
</table>

Parameters

8
NameTypeDefaultDescription
Appearance
BorderTableBorder—Style of the table border. See TableBorder for available styles like Rounded, Square, and Minimal.
BorderColorColor—Color of the table border. Default is White.
WidthNullable<Int32>—Width of the table in characters. If null or less than 1, automatically determined by content.
Common
ChildContentRenderFragment—Renders a formatted table using Spectre.Console's Table renderable.
TitleString—Title displayed above the table. If null or empty, no title is shown.
Other
AdditionalAttributesIReadOnlyDictionary<String, Object>—Additional HTML attributes to apply to the table element.
ExpandBoolean—Whether the table should expand to fill available space. Default is false.
ShowHeadersBoolean—Whether table headers should be displayed. Default is true.

API