Skip to main content
Home

Built and signed on GitHub Actions

Helper to create table on terminal.

This package works with Deno, Bun
This package works with Deno
This package works with Bun
JSR Score
100%
Published
5 months ago (0.1.6)

Tyble

Helper to create table on terminal.

Example to create a table:

    import { Column, Row, Table, TableStyle, TextAlign, TextStyle } from "@rkvcs/tyble";
    import { Chalk } from "npm:chalk";

    // Using chalk to format the columns.
    const chalk = new Chalk();
    
    const header = new Row(new Column("Col1"), new Column("Col2"))
    const footer = new Row(new Column(""), new Column(
			"TOTAL: 123",
			new TextStyle(chalk.blue).add(chalk.bold)
		))
    
    header.setAlign(TextAlign.CENTER)
    footer.setAlign(TextAlign.RIGHT)
    
    const table = new Table({
        columns: 2,
        width: 15,
        tableStyle: TableStyle.DEFAULT
    })

    table.addHeader(header)
    table.addFooter(footer)
    
    table.add(
        new Row(new Column("Line 1"), 
        new Column("Col 2"))
    )
    table.add(
        new Row(new Column("Line 2"), 
        new Column("Col 2"))
    )
    table.add(
        new Row(new Column("Line 3"), 
        new Column("Col 2"))
    )

    console.info(table.render())

Table's styles:

Built and signed on
GitHub Actions

New Ticket: Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@rkvcs/tyble

Import symbol

import * as tyble from "@rkvcs/tyble";
or

Import directly with a jsr specifier

import * as tyble from "jsr:@rkvcs/tyble";

Add Package

bunx jsr add @rkvcs/tyble

Import symbol

import * as tyble from "@rkvcs/tyble";