# cli-simple-table

> CLI simple table

Latest version **1.1.1** (published 2021-09-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install cli-simple-table
pnpm add cli-simple-table
yarn add cli-simple-table
bun add cli-simple-table
```

## Health

**Score 40/100 (D)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.1.1 |
| Published | 2021-09-23 |
| First published | 2020-06-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM |
| Dependencies | 3 |
| Unpacked size | 11.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 11 |
| Author | Hiroki Osame |
| Maintainers | hirokiosame |
| Keywords | cli, table, simple, minimal |

## Links

- npm: https://www.npmjs.com/package/cli-simple-table
- Repository: https://github.com/privatenumber/cli-simple-table
- Homepage: https://github.com/privatenumber/cli-simple-table#readme
- Issues: https://github.com/privatenumber/cli-simple-table/issues
- Funding: https://github.com/privatenumber/cli-simple-table?sponsor=1
- npm.io page: https://npm.io/package/cli-simple-table

## Dependencies (3)

- [colorette](https://npm.io/package/colorette.md) ^2.0.7
- [strip-ansi](https://npm.io/package/strip-ansi.md) ^6.0.0
- [cli-truncate](https://npm.io/package/cli-truncate.md) ^2.1.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.1.1 (latest) — 2021-09-23
- 1.1.0 — 2021-03-25
- 1.0.1 — 2020-12-07
- 1.0.0 — 2020-08-23
- 0.0.3 — 2020-06-20
- 0.0.2 — 2020-06-20
- 0.0.1 — 2020-06-10

## README

<p align="center">
  <img src="/.github/screenshot-1.png" width="70%">
  <br>
  <a href="https://npm.im/cli-simple-table"><img src="https://badgen.net/npm/v/cli-simple-table"></a>
  <a href="https://npm.im/cli-simple-table"><img src="https://badgen.net/npm/dm/cli-simple-table"></a>
  <a href="https://packagephobia.now.sh/result?p=cli-simple-table"><img src="https://packagephobia.now.sh/badge?p=cli-simple-table"></a>
  <br>
  <br>
  <i>Simple CLI table for simple people</i>
</p>

### Install
```sh
npm i cli-simple-table
```

### Basic usage
```js
const SimpleTable = require('cli-simple-table');
const chalk = require('chalk');

const table = new SimpleTable();

table.header('Name', 'Emoji');

table.row(chalk.red('Squid'), '🦑');
table.row(chalk.green('Frog'), '🐸');
table.row(chalk.yellow('Tiger'), '🐯');
table.row(chalk.blue('Whale'), '🐳');
table.row(chalk.magenta('Unicorn'), '🦄');
table.row(chalk.cyan('Dolphin'), '🐬');
table.row(chalk.white('Panda'), '🐼');

console.log(table.toString());
```


### Alignment
```js
const table = new SimpleTable();

table.header(
  'Name',
  {
    text: 'Age',
    align: 'right'
  }
);

table.row('Steve', 26);

console.log(table.toString());
```


### Max column width
```js
const table = new SimpleTable();

table.header(
  {
    text: 'Long text',
    maxWidth: 25,
  },
  {
    text: 'Long long text',
    maxWidth: 25,
  }
);

table.row('Truncates really really long text', chalk.magenta('Colored long long text too'));

console.log(table.toString());
```


## Options

- `columnPadding` `<Number>` (`10`) - Number of characters to pad the column content with

- `headerSeparator` `<Number>` (`1`) - Number of lines that separate the header from the table body

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