Skip to content
Back to search

tty-table

Cross-platform terminal table (Windows, Linux, macOS). Can also run in the browser console and provide. MCP server gives your coding agent with a quick way to add text-wrapped ASCII tables to your README or other files.

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today

Check it deeper on your machine

It has changed since its scan on 11 Nov 2026.

As a Claude Code plugin, install it and then ask Claude Code:

/plugin marketplace add keithmackay/mackayi/plugin install scanskillsafety@mackayiDo a deep scan of https://github.com/tecfu/tty-table with scanskillsafety

Or from a terminal, clone it and run it:

git clone https://github.com/keithmackay/scanskillsafety-skill ~/.claude/skills/scanskillsafetynode ~/.claude/skills/scanskillsafety/cli.cjs --deep 'https://github.com/tecfu/tty-table'

It checks the exact commit: every file, its packages against OSV (api.osv.dev), how it compares with this page's scan (findsafeskills.com receives the repository's address), and, if you agree, Claude reading every file with your own Claude subscription. It never runs the code.

Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/tecfu--tty-table/badge.svg)](/listings/tecfu--tty-table)

HTML

<a href="/listings/tecfu--tty-table"><img src="/api/listings/tecfu--tty-table/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 164 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. # tty-table
  2. A TypeScript-first terminal table renderer with a compatibility-oriented factory API.
  3. ## [Examples](examples/)
  4. [See here for complete example list](examples/)
  5. To view all example output:
  6. ```sh
  7. $ git clone https://github.com/tecfu/tty-table && cd tty-table && npm i
  8. $ npm run view-examples
  9. ```
  10. ### Terminal (Static)
  11. [examples/styles-and-formatting.js](examples/styles-and-formatting.js)
  12. ![Static](https://cloud.githubusercontent.com/assets/7478359/15691679/07142030-273f-11e6-8f1e-25728d558a2d.png "Static Example")
  13. ### Terminal (Streaming)
  14. ```
  15. $ node examples/data/fake-stream.js | tty-table --format json --header examples/config/header.js
  16. ```
  17. ![Streaming](https://user-images.githubusercontent.com/7478359/51738817-47c25700-204d-11e9-9df1-04e478331658.gif "tty-table streaming example")
  18. - See the built-in help for the terminal version of tty-table with:
  19. ```
  20. $ tty-table -h
  21. ```
  22. ### MCP server
  23. Expose tty-table to MCP clients (Claude, IDE agents, Cursor, etc.) over stdio.
  24. #### Client configuration
  25. ```json
  26. {
  27. "mcpServers": {
  28. "tty-table": {
  29. "command": "npx",
  30. "args": ["-y", "--package=tty-table", "tty-table-mcp"]
  31. }
  32. }
  33. }
  34. ```
  35. #### Tools
  36. | Tool | Description |
  37. |------|-------------|
  38. | `render_table` | Render data as an ASCII/Unicode terminal table. Accepts `header`, `rows`, and any tty-table `options`; returns the rendered table as text. |
  39. **Arguments for `render_table`:**
  40. | Name | Type | Required | Description |
  41. |------|------|----------|-------------|
  42. | `header` | `(string \| {value, align?, width?})[]` | no | Column definitions |
  43. | `rows` | `(unknown[] \| Record<string, unknown>)[]` | yes | Row data (arrays of cells, or objects keyed by column name) |
  44. | `options` | `object` | no | Any tty-table option (e.g. `width`, `borderStyle`, `align`, `compact`) |
  45. Example tool call:
  46. ```json
  47. {
  48. "header": [{ "value": "name" }, { "value": "score", "align": "right" }],
  49. "rows": [["Ada", 100], ["Grace", 98]],
  50. "options": { "width": 40 }
  51. }
  52. ```
  53. Rendered result:
  54. ```text
  55. ┌───────┬───────┐
  56. │ name │ score │
  57. ├───────┼───────┤
  58. │ Ada │ 100 │
  59. ├───────┼───────┤
  60. │ Grace │ 98 │
  61. └───────┴───────┘
  62. ```
  63. > Additional tools may be added in future releases under the same MCP server.
  64. ### Browser & Browser Console
  65. The published package ships a standalone IIFE bundle that exposes a `TtyTable` global. Load it directly from a CDN — no install or build step required:
  66. ```html
  67. <script src="https://cdn.jsdelivr.net/npm/tty-table@7/dist/browser/tty-table.global.js"></script>
  68. <script>
  69. const Table = TtyTable.default
  70. console.log(Table([{ value: "name" }, { value: "score" }], [["Ada", 100]], null).render())
  71. </script>
  72. ```
  73. - Try it online before installing: [live example on JSFiddle](https://jsfiddle.net/u9dqv14j/)
  74. - View the full example locally in Chrome or Chromium by opening [examples/browser-example.html](examples/browser-example.html) (e.g. served with `npx serve .` or any static file server).
  75. - [source: examples/browser-example.html](examples/browser-example.html)
  76. ![Browser Console Example](https://user-images.githubusercontent.com/7478359/74614563-cbcaff00-50e6-11ea-9101-5457497696b8.jpg "tty-table in the browser console")
  77. <br/>
  78. <br/>
  79. ## Compatibility
  80. ### Node.js
  81. **Current releases require Node.js 22 or newer.** This is a breaking change from the Node 20 baseline used by early v6 releases (and from the v5 line, which supported older Node.js releases). The floor was raised to match `smartwrap@4` / `breakword@2.1.0`. If your application must remain on Node 20, stay on a prior tty-table release until you can upgrade.
  82. The published package provides both ESM and CommonJS entry points for Node.js. The CLI requires Node.js 22+ as well.
  83. ## API
  84. ```ts
  85. import Table from "tty-table"
  86. const table = Table(
  87. [{ value: "name" }, { value: "score", align: "right" }],
  88. [
  89. { name: "Ada", score: 100 },
  90. { name: "Grace", score: 98 }
  91. ],
  92. { borderStyle: "solid" }
  93. )
  94. console.log(table.render())
  95. ```
  96. Legacy `Table(header, rows, footer, options)` and `Table(rows, options)` construction remains supported.
  97. ### Formatter context
  98. New code can use the explicit context form:
  99. ```ts
  100. const formatter = (value: unknown) => String(value).toUpperCase()
  101. ```
  102. The compatibility callback signature is still accepted. New integrations should prefer a formatter that accepts the documented context object and avoid relying on dynamic `this` mutation.
  103. ### Width semantics
  104. Widths are measured in terminal display columns, not JavaScript string length. ANSI escape sequences are ignored for measurement; Unicode code points are counted using [`breakword.width()`](https://github.com/tecfu/breakword) (Unicode 18.0.0 East Asian Width + UAX #51 Emoji_Presentation). Wrapping and truncation operate on the same display-width semantics.
  105. Compared with older releases that used `wcwidth`, some symbols that were previously treated as 1 cell are now 2 cells (for example `⚡` U+26A1). Tables containing those characters may reflow slightly; measurement is now aligned with the same library used for wrapping.
  106. ## Development
  107. ```sh
  108. npm install
  109. npm run typecheck
  110. npm run build
  111. npm test
  112. npm run test:unit
  113. npm run lint
  114. ```

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.