> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nemu.cc/llms.txt
> Use this file to discover all available pages before exploring further.

# Tables

> Build rows and columns with the low level table factory

`page.table` builds a table element. You define the columns up front, add rows of cells, then
add the table to the page. Each cell is plain string content or an object with content and a
style.

## Table options

```ts theme={null}
interface CreateTableOptions {
  columns: number | number[];
  style?: StyleProperties;
  position?: { x: number; y: number };
  width?: number;
  border_color?: ColorLike;
  border_width?: number;
  cell_padding?: number;
  header_style?: StyleProperties;
  cell_style?: StyleProperties;
  z_index?: number;
}
```

<ParamField path="columns" type="number | number[]" required>
  An equal count, or an array of absolute widths in points where `0` means auto width. For
  example `columns: [180, 0, 100]` sets two fixed columns with one auto column between them.
</ParamField>

<ParamField path="border_color" type="ColorLike">
  The color of the cell borders.
</ParamField>

<ParamField path="border_width" type="number">
  The thickness of the cell borders.
</ParamField>

<ParamField path="cell_padding" type="number">
  The padding inside every cell.
</ParamField>

<ParamField path="header_style" type="StyleProperties">
  The style applied to the first row, which is treated as the header.
</ParamField>

<ParamField path="cell_style" type="StyleProperties">
  The default style applied to body cells.
</ParamField>

## Adding rows

Build rows with `table.add_row`. The first row added receives `header_style`.

```ts theme={null}
table.add_row(cells: Array<string | TableCellInput>): this

interface TableCellInput {
  content: string;
  style?: StyleProperties;
}
```

## A complete table

```ts theme={null}
const table = page.table({
  columns: [180, 0, 100],
  border_width: 0.5,
  cell_padding: 8,
  header_style: { background_color: "#ebf4ff" },
  width: page.get_content_width(),
});
table.add_row(["Name", "Role", "Status"]);
table.add_row(["Alice Nguyen", "Lead Engineer", "Active"]);
table.add_row([
  { content: "Bob Chen", style: { color: "#718096" } },
  "Designer",
  "Active",
]);
page.add(table);
```

<Note>
  This low level table takes plain string cell content. For rich inline cells with bold text,
  links, and inline formulas, use the [Doc API table](/packages/pdf/doc/tables).
</Note>

## Related pages

<CardGroup cols={2}>
  <Card title="Layout" icon="objects-column" href="/packages/pdf/document/layout">
    Arrange tables and other elements with containers.
  </Card>

  <Card title="Themes" icon="palette" href="/packages/pdf/document/themes">
    Centralize colors used in cell and header styles.
  </Card>
</CardGroup>
