starlight-table
v1.0.1
Published
Flexible table and list builder for Starlight
Maintainers
Readme
starlight-table
Description
starlight-table is a flexible terminal table and list builder for Starlight. It does not force any predefined structure. Developers fully control columns, rows, and layout.
Why starlight-table?
- No predefined schema
- Builder-style API
- Add rows dynamically
- Works for products, reports, logs, and data views
- Outputs clean ASCII tables
Creating a Table
Use createTable() to start building a table.
` import { createTable } from "starlight-table"
let table = createTable() `
Setting Headers
Headers are optional. You can define any number of columns.
table.setHeaders(["Product", "Price", "Stock"])
Adding Rows
Rows can be added one by one or in batches.
table.addRow(["Keyboard", "$50", 10])
table.addRow(["Mouse", "$25", 20])
You can also add multiple rows at once.
table.addRows([
["Monitor", "$300", 5],
["USB Cable", "$5", 100]
])
Rendering the Table
Once your data is ready, render the table as a string.
const output = table.render()
This output can be printed using sldeploy.
Creating Lists
starlight-table also supports simple lists.
` import { createList } from "starlight-table"
const list = createList([ "Flexible", "Readable", "Developer-controlled" ]) `
Common Use Cases
- Product listings
- CLI dashboards
- Debug output
- Reports
- Log summaries
Design Philosophy
starlight-table is designed to:
- Give developers full control
- Remain simple and predictable
- Integrate naturally with Starlight
There are no limits on rows or columns.
You decide how your table looks.
