Table
DisplayRenders 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| Name | Type | Default | Description |
|---|---|---|---|
Appearance | |||
Border | TableBorder | — | Style of the table border. See TableBorder for available styles like Rounded, Square, and Minimal. |
BorderColor | Color | — | Color of the table border. Default is White. |
Width | Nullable<Int32> | — | Width of the table in characters. If null or less than 1, automatically determined by content. |
Common | |||
ChildContent | RenderFragment | — | Renders a formatted table using Spectre.Console's Table renderable. |
Title | String | — | Title displayed above the table. If null or empty, no title is shown. |
Other | |||
AdditionalAttributes | IReadOnlyDictionary<String, Object> | — | Additional HTML attributes to apply to the table element. |
Expand | Boolean | — | Whether the table should expand to fill available space. Default is false . |
ShowHeaders | Boolean | — | Whether table headers should be displayed. Default is true . |