Skip to main content
Module

x/cliffy/table/mod.ts>Cell

Command line framework for deno 🦕 Including Commandline-Interfaces, Prompts, CLI-Table, Arguments Parser and more...
Extremely Popular
Go to Latest
class Cell
import { Cell } from "https://deno.land/x/cliffy@v1.0.0-rc.3/table/mod.ts";

Cell representation.

Can be used to customize a single cell.

import { Cell, Table } from "./mod.ts";

new Table()
  .body([
    ["Foo", new Cell("Bar").align("right")],
    ["Beep", "Boop"],
  ])
  .render();

Constructors

new
Cell(value: CellValue)

Cell constructor.

Properties

protected
options: CellOptions
readonly
length: number

Get cell length.

Methods

align(direction: Direction, override?): this

Align cell content.

border(enable?, override?): this

Enable/disable cell border.

clone(value?: CellValue): Cell

Clone cell with all options.

colSpan(span: number, override?): this

Set col span.

import { Cell, Table } from "./mod.ts";

new Table()
  .body([
    [
      new Cell("Row 1 & 2 Column 1").rowSpan(2),
      "Row 1 Column 2",
      "Row 1 Column 3",
    ],
    [new Cell("Row 2 Column 2 & 3").colSpan(2)],
  ])
  .border()
  .render();

Get row span.

getBorder(): boolean

Check if cell has border.

getColSpan(): number

Get col span.

getRowSpan(): number

Get row span.

Get cell value.

rowSpan(span: number, override?): this

Set row span.

import { Cell, Table } from "./mod.ts";

new Table()
  .body([
    [
      new Cell("Row 1 & 2 Column 1").rowSpan(2),
      "Row 1 Column 2",
      "Row 1 Column 3",
    ],
    [new Cell("Row 2 Column 2 & 3").colSpan(2)],
  ])
  .border()
  .render();
setValue(value: CellValue): this

Set cell value.

toString(): string

Get cell string value.

Static Methods

from(value: CellType): Cell

Create a new cell. If value is a cell, the value and all options of the cell will be copied to the new cell.