Board Data Structure
IBoardData
IBoardData is the snapshot format used by Univer Boards. It describes one Board unit, including page order, page data, resources, themes, the active page, the zoom ratio, and board-level settings.
Properties
| Property | Type | Description |
|---|---|---|
| id | string | Unique id of the Board unit. |
| rev? | number | Optional revision value used by the persistence or collaboration layer. |
| name | string | Board name. |
| appVersion | string | Version of the package that created the snapshot. |
| locale? | string | Locale of the board. |
| defaultPageSize | IBoardPageSize | Default size of the Board pages. |
| pageOrder | string[] | Ordered list of Board page ids. |
| pages | Record\<string, IBoardPage\> | Page snapshots, keyed by page id. |
| activePageId? | string | Id of the active page. |
| theme? | IBoardThemeData | Current board theme. |
| themes? | Record\<string, IBoardThemeData\> | Additional named themes. |
| zoomRatio? | number | Current zoom ratio. |
| resources? | IResources | External resources used by images, rich text, tables, and other elements. |
| custom? | `Record<string, unknown> | null` |
| boardSettings? | IBoardSettings | Board-level UI and interaction settings. |
Page data
IBoardPage stores elements in a map keyed by id, and elementOrder defines the order in which they render. Keep the two structures in sync when you construct a snapshot yourself.
TypeScript
const boardData = { id: 'board-1', name: 'Planning board', appVersion: '1.0.0', defaultPageSize: { width: 1920, height: 1080 }, pageOrder: ['page-1'], pages: { 'page-1': { id: 'page-1', pageType: 'page', name: 'Page 1', elementOrder: ['text-1'], elements: { 'text-1': { id: 'text-1', type: 'text', transform: { left: 120, top: 96, width: 240, height: 80 }, text: 'Kickoff', }, }, }, }, activePageId: 'page-1',}Usage
The main uses of IBoardData are:
- Creating a
UniverInstanceType.UNIVER_BOARDunit. - Persisting and restoring Board documents.
- Preparing data for import, export, or server-side processing.
- Seeding a Board with pages, elements, and settings before the first render.
Snapshot objects are persistence data. Once a Board is running, use the Facade APIs instead of mutating the snapshot object directly.
How is this guide?