# chalk-table

> `chalk-table` is a small terminal table tool that comes with chalk support out of the box.

Latest version **1.0.2** (published 2019-03-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install chalk-table
pnpm add chalk-table
yarn add chalk-table
bun add chalk-table
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2019-03-28 |
| First published | 2019-03-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 84.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 31 |
| Author | BM |
| Maintainers | bukharim96 |
| Keywords | ascii, table, console, terminal, chalk |

## Links

- npm: https://www.npmjs.com/package/chalk-table
- Repository: https://github.com/bukharim96/chalk-table
- Homepage: https://github.com/bukharim96/chalk-table#readme
- Issues: https://github.com/bukharim96/chalk-table/issues
- npm.io page: https://npm.io/package/chalk-table

## Dependencies (2)

- [chalk](https://npm.io/package/chalk.md) ^2.4.2
- [strip-ansi](https://npm.io/package/strip-ansi.md) ^5.2.0

## Alternatives

- [@lexical/table](https://npm.io/package/@lexical/table.md) — 3.0M weekly downloads
- [mantine-datatable](https://npm.io/package/mantine-datatable.md) — 98.2K weekly downloads
- [react-native-collapsible-tab-view](https://npm.io/package/react-native-collapsible-tab-view.md) — 70.6K weekly downloads
- [@handsontable/vue3](https://npm.io/package/@handsontable/vue3.md) — 16.1K weekly downloads
- [vuewordcloud](https://npm.io/package/vuewordcloud.md) — 7.2K weekly downloads

## Recent versions

- 1.0.2 (latest) — 2019-03-28
- 1.0.1 — 2019-03-28
- 1.0.0 — 2019-03-28

## README

# Chalk Table

`chalk-table` is a small terminal table tool that comes with chalk support out of the box.

It is a project I forked from [@deoxxa](http://github.com/deoxxa)'s cool `asciitable` package. I've added support for chalk and a few extra fixes. In case you're wondering, it can still render simple tables with headings and pretty hyphen/pipe character-based formatting.

## Install

```shell
npm i chalk-table --save
```

If you use yarn, you know how it goes. :D

## Quick example:

We'll render the following ascii table:

<img height="170px" src="https://raw.githubusercontent.com/bukharim96/chalk-table/master/resources/screenshot.png">

The above example table has been built with the following code:

```javascript
const chalk = require("chalk");
const chalkTable = require("../src");

const options = {
  leftPad: 2,
  columns: [
    { field: "id",     name: chalk.cyan("ID") },
    { field: "fruit",  name: chalk.magenta("Fruit") },
    { field: "veggie", name: chalk.green("Vegetable") },
    { field: "other",  name: chalk.yellow("Other") }
  ]
};

const table = chalkTable(options, [
  { id: 0, fruit: "🍇 Grapes",     veggie: "🌽 Maize",    other: "🍕 Pizza" },
  { id: 1, fruit: "🍈 Melon",      veggie: "🍅 Tomato",   other: "🍔 Hamburger" },
  { id: 2, fruit: "🍉 Watermelon", veggie: "🥑 Avocado",  other: "🌭 Hot Dog" },
  { id: 3, fruit: "🍊 Tangerine",  veggie: "🥦 Broccoli", other: "🥪 Sandwich" },
  { id: 4, fruit: "🍍 Pineapple",  veggie: "🥒 Cucumber", other: "🌮 Taco" }
]);

console.log(table);
```

There are a few key differences from `asciitable`'s default settings. For instance:
 -  the `intersectionCharacter` option defaults to a `+` character.
 - There's an additional `leftPad` option which allows control over how many padding the table should be from the left of the terminal view.
- There's also no `skinny` option.

For more documentation or a _getting-started_ guide, head over to `asciitable`'s [repository](https://github.com/deoxxa/asciitable).

Happy hacking!

---
_Source: https://npm.io/package/chalk-table · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
