ConsoleTable.Core 1.0.6

dotnet add package ConsoleTable.Core --version 1.0.6
                    
NuGet\Install-Package ConsoleTable.Core -Version 1.0.6
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ConsoleTable.Core" Version="1.0.6" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ConsoleTable.Core" Version="1.0.6" />
                    
Directory.Packages.props
<PackageReference Include="ConsoleTable.Core" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ConsoleTable.Core --version 1.0.6
                    
#r "nuget: ConsoleTable.Core, 1.0.6"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package ConsoleTable.Core@1.0.6
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ConsoleTable.Core&version=1.0.6
                    
Install as a Cake Addin
#tool nuget:?package=ConsoleTable.Core&version=1.0.6
                    
Install as a Cake Tool

Console Table

ConsoleTable is a powerful and flexible .NET library for building and rendering beautiful console tables with minimal effort. It provides a fluent API for creating customizable tables with various themes, pagination support, and text formatting features.

Features

  • Multiple built-in themes: ASCII, Minimal, Classic, Double Line, Rounded, NoBorder
  • Fluent API using builder pattern
  • Pagination support for large datasets
  • Automatic data binding from any collection of objects
  • Column customization: alignment, width, and more
  • Text wrapping support
  • High performance and low memory usage

Installation

dotnet add package ConsoleTable.Core --version 1.0.6

Basic Usage

Automatic Data Binding

using ConsoleTable.Core.Builder;
using ConsoleTable.Core.Rendering;
using ConsoleTable.Core.Themes;

var builder = new TableBuilder(opt =>
{
    opt.Title = "Team Members";
    opt.WrapData = false;
})
.WithData(users)
.WithTheme(new RoundedTheme());

var table = builder.Build();
new ConsoleRenderer().Print(table);

Manual Columns with Custom Settings

var builder = new TableBuilder()
    .WithTitle("Team Members")
    .WithColumns("ID", "Name", "Occupation", "Country")
    .WithColumn("Description", HorizontalAlignment.Right, 40)
    .WithTheme(new BoxTheme())
    .WrapData(true);

foreach (User user in users)
{
    builder.AddRow(user.ID, user.Name, user.Occupation, user.Country, user.Description);
}

var table = builder.Build();
new ConsoleRenderer().Print(table);

Table Options

You can configure core rendering and behavior via TableOptions.

var builder = new TableBuilder(opt =>
{
    opt.Title = "My Table";
    opt.WrapData = true;
    opt.ShowRowLines = true;
    opt.EnableDataCount = true;
});

Available options include:

  • Title: Set the table title
  • WrapData: Enable or disable text wrapping
  • ShowRowLines: Toggle row separator lines
  • EnableDataCount: Show the row count at the bottom

Adding Columns

// Default columns
builder.WithColumns("ID", "Name", "Occupation");

// Custom column with alignment and width
builder.WithColumn("Description", HorizontalAlignment.Right, 40);

Adding Data

// Manual row
builder.AddRow(1, "Mahammad Ahmadov", "Developer", "Some long description here...");

// Automatic binding
builder.WithData(users);

// Binding with predefined columns
builder.WithData(users, usePredefinedColumns: true);

Formatted Rows and Custom Cell Configuration

You can control each cell’s alignment and optional color using AddFormattedRow.

var builder = new TableBuilder(opt =>
{
    opt.Title = "Custom Formatted Row";
    opt.WrapData = true;
})
.WithData(InMemoryDatabase.Users)
.AddFormattedRow(
    (1, HorizontalAlignment.Left, null),
    ("Filankes", HorizontalAlignment.Left, null),
    ("None", HorizontalAlignment.Center, null),
    ("Sumgait", HorizontalAlignment.Right, null),
    ("Long Description", HorizontalAlignment.Right, null)
)
.WithTheme(new RoundedTheme());

var table = builder.Build();
new ConsoleRenderer().Print(table);

Each tuple consists of (value, alignment, optional color).

Pagination Support

IPager<User> pager = new DefaultPager<User>(users, pageSize: 10);

var consolePager = new ConsolePager<User>(pager, data =>
{
    return new TableBuilder()
        .WithData(data)
        .WithTheme(new RoundedTheme())
        .Build();
});

consolePager.Run();

Example visuals:

pagination_1 > pagination_2

Themes

ConsoleTable includes the following themes:

+-------------+----------+----------+
| ASCII       | Classic  | Rounded  |
| Double Line | Minimal  | NoBorder |
+-------------+----------+----------+

Example visuals:

theme_1 > theme_2

Performance Benchmarks

ConsoleTable is designed for high performance even on large datasets:

BenchmarkDotNet v0.14.0, Windows 11 (10.0.22631.3155/23H2/2023Update/SunValley3)
13th Gen Intel Core i7-1355U, 1 CPU, 12 logical and 10 physical cores
.NET SDK 9.0.102

[Host] : .NET 8.0.12 (8.0.1224.60305), X64 RyuJIT AVX2
DefaultJob : .NET 8.0.12 (8.0.1224.60305), X64 RyuJIT AVX2

Method Mean Error StdDev Gen0 Gen1 Gen2 Allocated
Render_10_Users 2.945 μs 0.0459 μs 0.0429 μs 1.7242 0.0610 - 10.58 KB
Render_100_Users 29.033 μs 1.5081 μs 4.3511 μs 13.3057 2.1973 - 81.77 KB
Render_1000_Users 427.705 μs 10.1782 μs 29.0389 μs 132.8125 132.3242 66.4063 817.29 KB

Complete Sample Application

using System.Text;
using ConsoleTable.Core.Builder;
using ConsoleTable.Core.Rendering;
using ConsoleTable.Core.Themes;
using ConsoleTable.Data;

namespace BasicSample;
internal class Program
{
    private static void Main(string[] args)
    {
        Console.OutputEncoding = Encoding.UTF8;

        var builder = new TableBuilder(opt =>
        {
            opt.Title = "Team Members";
            opt.WrapData = false;
        })
        .WithData(InMemoryDatabase.Users)
        .WithTheme(new RoundedTheme());

        var table = builder.Build();
        new ConsoleRenderer().Print(table);
    }
}

Contributing

We welcome contributions from everyone.

Before you begin, ensure you have a local copy of the repository and the latest changes from the main branch. When you are ready to work on a new feature or fix, create a new branch using a clear and descriptive name, for example feature/add-pagination-support or fix/table-rendering-bug.

Make your changes in that branch, writing clear commit messages that explain what you did and why. Once your work is complete, push the branch to your fork or directly to the repository and open a pull request against main. In your pull request description, include a concise summary of the changes and any relevant context or testing details. We will review your pull request as soon as possible, provide feedback if needed, and merge it once it meets project guidelines.

Thank you for contributing to ConsoleTable and helping improve its functionality and usability.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.6 143 5/7/2025