CLI Tableau

2.0.1 · active · verified Wed Apr 22

cli-tableau is a robust JavaScript library designed for rendering pretty, highly customizable tables in command-line interfaces using Unicode characters. It offers extensive control over table structure, including options for horizontal, vertical, and cross-table layouts, and allows for detailed customization of borders, column widths, and styling characters. The current stable version, 2.0.1, indicates a mature codebase. Its release cadence appears to be relatively slow, focusing on stability. A key differentiator is its granular control over the `chars` property, enabling developers to define every single line and intersection character, from full Unicode borders to completely invisible separators, offering unparalleled flexibility in visual output compared to simpler table rendering utilities. It is primarily used within Node.js environments for CLI tools.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates creating a basic horizontal table with custom headers, column widths, and basic styling, then populating it with data rows for console output.

const Table = require('cli-tableau');

const table = new Table({
    head: ['Task Description', 'Status', 'Due Date'],
    colWidths: [40, 15, 20],
    style: {
        'padding-left': 1,
        'padding-right': 1,
        'head': ['cyan'],
        'border': ['grey'],
        'compact': true // Makes rows more compact
    }
});

table.push(
    ['Implement feature X', 'In Progress', '2024-05-01'],
    ['Fix bug Y in module Z', 'Pending Review', '2024-04-28'],
    ['Write documentation for API V2', 'Not Started', '2024-05-15']
);

console.log(table.toString());

view raw JSON →