$ Table

static output

Formatted data tables with headers, auto-sized columns, alternating row colors, and Unicode box-drawing borders.

# Preview

table demo
┌───────────┬──────────┬─────────┐
│ NameRoleStatus  │
├───────────┼──────────┼─────────┤
│ Alice     │ Engineer │ Active  │
│ BobDesignerAway    │
│ Charlie   │ Manager  │ Active  │
└───────────┴──────────┴─────────┘

# Usage

example.ts
import { Table, fg, colorize } from "@vr_patel/tui";

const table = new Table({
  headers: ["Name", "Role", "Status"],
  rows: [
    ["Alice", "Engineer", colorize("Active", fg.green)],
    ["Bob",   "Designer", colorize("Away", fg.yellow)],
    ["Charlie", "Manager", colorize("Active", fg.green)],
  ],
  alternateRowColor: true,
});

console.log(table.render());

# API

PropTypeDefaultDescription
headersstring[]requiredColumn header labels
rowsstring[][]required2D array of cell values
borderColorstringfg.grayColor for table borders
headerColorstringfg.cyan + boldColor for header row
alternateRowColorbooleantrueAlternate row shading
paddingnumber1Cell padding in spaces