# Table

- Human documentation: [https://docs.univer.ai/guides/boards/features/tables](https://docs.univer.ai/guides/boards/features/tables)

- Agent Markdown: [https://docs.univer.ai/guides/boards/features/tables.md](https://docs.univer.ai/guides/boards/features/tables.md)

- Requested language: `en-US`

- Content language: `en-US`

- Documentation version: `1.0.0-rc.0`

- Source: [boards/features/tables.mdx](https://github.com/dream-num/documentation/blob/dev/content/guides/boards/features/tables.mdx)

---

#### Package metadata

```json
{
  "preset": [],
  "plugins": [
    {
      "client": "@univerjs-pro/boards-table",
      "facade": "@univerjs-pro/boards-table/facade"
    },
    {
      "client": "@univerjs-pro/boards-table-ui",
      "locale": "@univerjs-pro/boards-table-ui/locale/en-US",
      "style": "@univerjs-pro/boards-table-ui/lib/index.css"
    }
  ],
  "server": false
}
```

Board table support is split into model and UI packages. Register both packages in browser editors that need editable table elements on the Board canvas.

## Register table support

```ts
import { UniverBoardsTablePlugin } from '@univerjs-pro/boards-table'
import { UniverBoardsTableUIPlugin } from '@univerjs-pro/boards-table-ui'
import BoardsTableUIEnUS from '@univerjs-pro/boards-table-ui/locale/en-US'

import '@univerjs-pro/boards-table/facade'
import '@univerjs-pro/boards-table-ui/lib/index.css'

univer.registerPlugin(UniverBoardsTablePlugin)
univer.registerPlugin(UniverBoardsTableUIPlugin)
```

## Package responsibilities

* `@univerjs-pro/boards-table` integrates table elements with the Board model.
* `@univerjs-pro/boards-table-ui` adds table rendering and editing UI on the Board canvas. It also provides `@univerjs-pro/boards-table-ui/locale/*` and `@univerjs-pro/boards-table-ui/lib/index.css` for browser editors.

## Snapshot data

A Board table element stores a `tableId` and common Board element fields. The table payload is managed by the table plugin and referenced through Board resources.

```ts
const table = board.insertTable({
  left: 120,
  top: 120,
  width: 480,
  height: 280,
  rows: 3,
  columns: 4,
})
if (!table) throw new Error('Cannot insert Board table')
```

Register table support before opening snapshots that contain `table` elements.

## Stable table colors

When a Board table is inserted or its style changes, the plugin stores the resolved theme palette with that table. Existing tables keep their colors after the global Univer theme changes; selecting another table style creates a new table-owned theme snapshot.
