> For the complete documentation index, see [llms.txt](https://voici.larswaechter.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://voici.larswaechter.dev/reference/api-reference/config.md).

# Config

The Table Config type definition.

{% hint style="info" %}
All options are **optional**. For options not provided, the default values are used.
{% endhint %}

The top level configuration of voici.js:

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

<table><thead><tr><th width="183.0572244933896">Name</th><th width="150">Type</th><th width="154">Default</th><th>Description</th></tr></thead><tbody><tr><td>align</td><td><code>string</code></td><td><code>'LEFT' | 'CENTER' | 'RIGHT'</code></td><td>The text alignment.</td></tr><tr><td>bgColorColumns</td><td><code>string[]</code></td><td><code>[]</code></td><td>The background hex color for each column.</td></tr><tr><td>sort</td><td><a href="/reference/api-reference/sort.md"><code>Sort</code></a></td><td><code>{columns: [], directions: []}</code></td><td>The table sort order.</td></tr></tbody></table>

### body

<table><thead><tr><th width="153.03333173928132">Name</th><th width="150">Type</th><th width="150">Default</th><th>Description</th></tr></thead><tbody><tr><td>bgColor</td><td><code>string</code></td><td><code>''</code></td><td>The background hex color of the body.</td></tr><tr><td>fillEmpty</td><td><code>{ColumnName: () => T}</code></td><td><code>{}</code></td><td>An object where the keys are column names and the values are functions which return a value that fills empty values </td></tr><tr><td>peek</td><td><code>number | [number, number]</code></td><td><code>0</code></td><td>Print only the top and last <code>n</code> rows.</td></tr><tr><td>precision</td><td><code>number</code></td><td><code>3</code></td><td>The floating point precision of numbers.</td></tr><tr><td>striped</td><td><code>boolean</code></td><td><code>true</code></td><td>Whether the row background should be striped.</td></tr><tr><td>subset</td><td><code>[number?, number?]</code></td><td><code>[]</code></td><td>Use only a subset of the provided dataset</td></tr><tr><td>textColor</td><td><code>string</code></td><td><code>''</code></td><td>The text hex color of the rows.</td></tr></tbody></table>

#### accumulation

<table><thead><tr><th width="150">Name</th><th width="202.42857142857144">Type</th><th width="150">Default</th><th>Description</th></tr></thead><tbody><tr><td>bgColor</td><td><code>string</code></td><td>''</td><td>The background hex color of the accumulation row.</td></tr><tr><td>columns</td><td><a href="/examples/accumulation.md"><code>Accumulation</code></a><code>[]</code></td><td><code>[]</code></td><td>The accumulation column definitions.</td></tr><tr><td>separator</td><td><code>string</code></td><td><code>'-'</code></td><td>The separator character.</td></tr></tbody></table>

#### highlightCell

<table><thead><tr><th width="161.91184573002755">Name</th><th width="225">Type</th><th width="150">Default</th><th>Description</th></tr></thead><tbody><tr><td>bold</td><td><code>boolean</code></td><td><code>false</code></td><td>Whether the cell text should be bold.</td></tr><tr><td>func</td><td><code>(content: unknown, row: number, col: string | number) => boolean</code></td><td><code>null</code></td><td>The callback to determine whether to highlight or not.</td></tr><tr><td>italic</td><td><code>boolean</code></td><td><code>false</code></td><td>Whether the cell text should be italic.</td></tr><tr><td>textColor</td><td><code>string</code></td><td><code>''</code></td><td>The text hex color of the highlighted cell.</td></tr><tr><td>underline</td><td><code>boolean</code></td><td><code>false</code></td><td>Whether the cell text should be underlined.</td></tr></tbody></table>

#### highlightRow

<table><thead><tr><th width="150">Name</th><th>Type</th><th width="150">Default</th><th>Description</th></tr></thead><tbody><tr><td>bgColor</td><td><code>string</code></td><td><code>''</code></td><td>The background hex color of the highlighted row.</td></tr><tr><td>func</td><td><code>(row: T, index: number) => boolean</code></td><td><code>null</code></td><td>The callback to determine whether to highlight or not.</td></tr></tbody></table>

### border

<table><thead><tr><th width="159.08761329305136">Name</th><th width="150">Type</th><th width="150">Default</th><th>Description</th></tr></thead><tbody><tr><td>color</td><td><code>string</code></td><td><code>''</code></td><td>The border hex color.</td></tr><tr><td>groupSize</td><td><code>number</code></td><td><code>1</code></td><td>The number of rows before the horizontal border is applied</td></tr><tr><td>horizontal</td><td><code>string</code></td><td><code>''</code></td><td>The horizontal border character.</td></tr><tr><td>vertical</td><td><code>string</code></td><td><code>''</code></td><td>The vertical border character.</td></tr></tbody></table>

### header

<table><thead><tr><th width="175.99437661562933">Name</th><th width="203.40370898716117">Type</th><th width="150">Default</th><th>Description</th></tr></thead><tbody><tr><td>bgColor</td><td><code>string</code></td><td><code>''</code></td><td>The background hex color of the header.</td></tr><tr><td>bold</td><td><code>boolean</code></td><td><code>false</code></td><td>Whether the header names should be written in bold.</td></tr><tr><td>displayNames</td><td><code>object</code></td><td><code>{}</code></td><td>The display names of the columns.</td></tr><tr><td>dynamic</td><td><a href="broken://pages/58ZS1C44lo52g3lEl1X5"><code>DynamicColumn[]</code></a></td><td><code>[]</code></td><td>The dynamic column definitions.</td></tr><tr><td>exclude</td><td><code>string[]</code></td><td><code>[]</code></td><td>The names of the columns to exclude.</td></tr><tr><td>include</td><td><code>string[]</code></td><td><code>[]</code></td><td>The names of the columns to include.</td></tr><tr><td>italic</td><td><code>boolean</code></td><td><code>false</code></td><td>Whether the header names should be written in italic.</td></tr><tr><td>numeration</td><td><code>boolean</code></td><td><code>false</code></td><td>Whether to add a numeration column.</td></tr><tr><td>order</td><td><code>string[] | number[]</code></td><td><code>[]</code></td><td>The column sort order.</td></tr><tr><td>separator</td><td><code>string</code></td><td><code>'='</code></td><td>The separator char between header and body.</td></tr><tr><td>textColor</td><td><code>string</code></td><td><code>''</code></td><td>The text hex color of the header.</td></tr><tr><td>underline</td><td><code>boolean</code></td><td><code>false</code></td><td>Whether the header names should be written in underline.</td></tr><tr><td>uppercase</td><td><code>boolean</code></td><td><code>false</code></td><td>Whether the header names should be written in uppercase.</td></tr><tr><td>upperfirst</td><td><code>boolean</code></td><td><code>false</code></td><td>Whether the first char of each header name should be written in uppercase.</td></tr><tr><td>width</td><td><code>'auto' | number</code></td><td><code>'auto'</code></td><td>The fixed width of each column.</td></tr><tr><td>maxWidth</td><td><code>'auto' | number</code></td><td><code>'auto'</code></td><td>The fixed max-width of each column.</td></tr></tbody></table>

### padding

<table><thead><tr><th width="150">Name</th><th width="150">Type</th><th width="150">Default</th><th>Description</th></tr></thead><tbody><tr><td>char</td><td><code>string</code></td><td><code>' '</code></td><td>The padding character.</td></tr><tr><td>size</td><td><code>number</code></td><td><code>2</code></td><td>The padding size.</td></tr></tbody></table>

{% hint style="info" %}
See the TypeDoc [documentation](https://larswaechter.github.io/voici.js/modules.html#Config) too.
{% endhint %}
