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
BorderTableBorderStyle of the table border. See TableBorder for available styles like Rounded, Square, and Minimal.
BorderColorColorColor 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
ChildContentRenderFragmentRenders a formatted table using Spectre.Console's Table renderable.
TitleStringTitle 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.
ExpandBooleanWhether the table should expand to fill available space. Default is false .
ShowHeadersBooleanWhether table headers should be displayed. Default is true .

API