Skip to main content

Alignment

You can put properties for alignment

const { Table } = require("console-table-printer");

const p = new Table({
columns: [
{ name: "index", alignment: "left" },
{ name: "text", alignment: "right" },
{ name: "is_priority_today", alignment: "center" },
],
});

p.addRow({ index: 1, text: "red wine", value: 10.212 }, { color: "green" });
p.addRow({ index: 2, text: "green gemuse", value: 20.0 });
p.addRow(
{ index: 3, text: "gelb bananen", value: 100, is_priority_today: "Y" },
{ color: "yellow" }
);
p.addRow(
{ index: 3, text: "rosa hemd wie immer", value: 100 },
{ color: "cyan" }
);
p.printTable();
Screenshot

possible alignment values for columns

  • left
  • right
  • center