{"id":16789,"library":"cli-table3","title":"CLI Table 3: Pretty Unicode Tables","description":"cli-table3 is an active utility library for Node.js environments, providing a robust mechanism to render highly customizable unicode-aided tables directly in the command line. As of version 0.6.5, it offers features such as cell spanning (both column and row), individual cell styling (borders, padding), flexible text alignment, word wrapping with configurable boundaries, and enhanced handling of ANSI color characters within cell content. It is the maintained successor and API-compatible evolution of the unmaintained `cli-table` and `cli-table2` packages. Releases are consistent, addressing bug fixes and introducing enhancements like hyperlink support, `bigint` cell content, and improved TypeScript types. It ships with comprehensive TypeScript type definitions, making it suitable for modern JavaScript and TypeScript projects.","status":"active","version":"0.6.5","language":"javascript","source_language":"en","source_url":"https://github.com/cli-table/cli-table3","tags":["javascript","node","command","line","cli","table","tables","tabular","unicode","typescript"],"install":[{"cmd":"npm install cli-table3","lang":"bash","label":"npm"},{"cmd":"yarn add cli-table3","lang":"bash","label":"yarn"},{"cmd":"pnpm add cli-table3","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"The primary `Table` class is exported as a default export in ESM. CommonJS uses `require('cli-table3')` directly.","wrong":"import { Table } from 'cli-table3';","symbol":"Table","correct":"import Table from 'cli-table3';"},{"note":"Type definitions like `TableOptions` are available as named exports. Ensure you still use the default import for the `Table` class.","wrong":"import { Table, TableOptions } from 'cli-table3';","symbol":"Table.TableOptions","correct":"import Table, { TableOptions } from 'cli-table3';"},{"note":"Import types using `import type` for clarity and to avoid bundling issues in some build setups.","wrong":"import { CellOptions } from 'cli-table3';","symbol":"CellOptions","correct":"import type { CellOptions } from 'cli-table3';"}],"quickstart":{"code":"import Table, { TableOptions, CellOptions } from 'cli-table3';\n\ninterface MyRow {\n  header1: string | CellOptions;\n  header2: string | CellOptions;\n}\n\nconst tableConfig: TableOptions = {\n  head: ['Project', 'Status', 'Progress'],\n  colWidths: [30, 15, 20],\n  wordWrap: true,\n  style: {\n    'header': ['cyan', 'bold'],\n    'border': ['grey'],\n    'compact': true\n  }\n};\n\nconst table = new Table(tableConfig);\n\n// Add rows\ntable.push(\n  ['CLI Table 3', { content: 'Active', style: { fg: 'green' } }, '100%'],\n  ['Feature A', 'In Development', { content: '60%', style: { fg: 'yellow' } }],\n  ['Feature B', { content: 'On Hold', style: { fg: 'red' } }, '10%'],\n  [{ content: 'Total tasks: 3', colSpan: 3, hAlign: 'center' }]\n);\n\nconsole.log(table.toString());\n\n// Example of a vertical table\nconst verticalTable = new Table();\nverticalTable.push(\n  { 'Name': 'Alice' },\n  { 'Age': '30' },\n  { 'City': 'New York' }\n);\nconsole.log('\\n--- Vertical Table ---\\n');\nconsole.log(verticalTable.toString());","lang":"typescript","description":"Demonstrates creating a horizontal table with headers, custom column widths, and cell styling, including a column span. It also shows a basic vertical table setup."},"warnings":[{"fix":"Ensure your Node.js environment is version 10.* or >= 12.*. Update your `engines` field in `package.json` accordingly if deploying.","message":"Node.js version requirements were updated in v0.5.0. Projects using older Node.js runtimes (prior to 10.* or 12.*) will encounter errors.","severity":"breaking","affected_versions":">=0.5.0"},{"fix":"Always use `npm install cli-table3` or `yarn add cli-table3`. Avoid the older, unmaintained packages to prevent security vulnerabilities and unpatched bugs.","message":"cli-table3 is the maintained successor to the unmaintained `cli-table` and `cli-table2` packages. While API compatible, always install `cli-table3` to receive ongoing updates and bug fixes.","severity":"gotcha","affected_versions":">=0.4.0"},{"fix":"Review the changelog for v0.4.0 and higher when migrating from `cli-table2`. Test your application thoroughly after upgrading.","message":"The initial release of `cli-table3` (v0.4.0) introduced breaking changes compared to `cli-table2` (e.g., removal of 'lodash' dependency, internal refactors). While API compatible at a high level, direct migration from `cli-table2` might require minor adjustments if relying on specific internals or removed dependencies.","severity":"breaking","affected_versions":">=0.4.0"}],"env_vars":null,"last_verified":"2026-04-22T00:00:00.000Z","next_check":"2026-07-21T00:00:00.000Z","problems":[{"fix":"Use the correct default import syntax: `import Table from 'cli-table3';`.","cause":"Attempting to use named import syntax (`import { Table } from 'cli-table3';`) for the main `Table` class, which is a default export.","error":"TypeError: Table is not a constructor"},{"fix":"Upgrade your Node.js runtime to version 10.* or >= 12.*. You can use tools like `nvm` (Node Version Manager) to manage multiple Node.js versions.","cause":"Running `cli-table3` on an unsupported Node.js version, specifically older than 10.x or between 10.x and 12.x.","error":"Error: cli-table3 requires Node.js version 10.* || >= 12.*"},{"fix":"Ensure you are using `cli-table3` version 0.6.2 or higher, as `href` support was added in this version. Update your package and regenerate `node_modules/@types` if necessary.","cause":"Attempting to use the `href` property within `CellOptions` (for hyperlink support) with an older version of `cli-table3` or outdated TypeScript type definitions.","error":"Property 'href' does not exist on type 'CellOptions'"}],"ecosystem":"npm","meta_description":null}