Config

The Table Config type definition.

All options are optional. For options not provided, the default values are used.

The top level configuration of voici.js:

const config = {
  align: 'LEFT',
  bgColorColumns: [],
  body: {},
  border: {},
  header: {},
  sort: {},
  padding: {}
};
NameTypeDefaultDescription

align

string

'LEFT' | 'CENTER' | 'RIGHT'

The text alignment.

bgColorColumns

string[]

[]

The background hex color for each column.

sort

{columns: [], directions: []}

The table sort order.

body

NameTypeDefaultDescription

bgColor

string

''

The background hex color of the body.

fillEmpty

{ColumnName: () => T}

{}

An object where the keys are column names and the values are functions which return a value that fills empty values

peek

number | [number, number]

0

Print only the top and last n rows.

precision

number

3

The floating point precision of numbers.

striped

boolean

true

Whether the row background should be striped.

subset

[number?, number?]

[]

Use only a subset of the provided dataset

textColor

string

''

The text hex color of the rows.

accumulation

NameTypeDefaultDescription

bgColor

string

''

The background hex color of the accumulation row.

columns

[]

The accumulation column definitions.

separator

string

'-'

The separator character.

highlightCell

NameTypeDefaultDescription

bold

boolean

false

Whether the cell text should be bold.

func

(content: unknown, row: number, col: string | number) => boolean

null

The callback to determine whether to highlight or not.

italic

boolean

false

Whether the cell text should be italic.

textColor

string

''

The text hex color of the highlighted cell.

underline

boolean

false

Whether the cell text should be underlined.

highlightRow

NameTypeDefaultDescription

bgColor

string

''

The background hex color of the highlighted row.

func

(row: T, index: number) => boolean

null

The callback to determine whether to highlight or not.

border

NameTypeDefaultDescription

color

string

''

The border hex color.

groupSize

number

1

The number of rows before the horizontal border is applied

horizontal

string

''

The horizontal border character.

vertical

string

''

The vertical border character.

NameTypeDefaultDescription

bgColor

string

''

The background hex color of the header.

bold

boolean

false

Whether the header names should be written in bold.

displayNames

object

{}

The display names of the columns.

dynamic

DynamicColumn[]

[]

The dynamic column definitions.

exclude

string[]

[]

The names of the columns to exclude.

include

string[]

[]

The names of the columns to include.

italic

boolean

false

Whether the header names should be written in italic.

numeration

boolean

false

Whether to add a numeration column.

order

string[] | number[]

[]

The column sort order.

separator

string

'='

The separator char between header and body.

textColor

string

''

The text hex color of the header.

underline

boolean

false

Whether the header names should be written in underline.

uppercase

boolean

false

Whether the header names should be written in uppercase.

upperfirst

boolean

false

Whether the first char of each header name should be written in uppercase.

width

'auto' | number

'auto'

The fixed width of each column.

maxWidth

'auto' | number

'auto'

The fixed max-width of each column.

padding

NameTypeDefaultDescription

char

string

' '

The padding character.

size

number

2

The padding size.

See the TypeDoc documentation too.

Last updated