Installation & Basic Usage
Univer Boards is part of the Univer Office SDK and currently ships in plugin mode. This page covers installation and the steps required to render a first editor.
If you are unfamiliar with Univer's core concepts, read Quickstart first.
Univer supports two integration modes: Preset Mode and Plugin Mode. Preset Mode reduces setup work by bundling a preconfigured set of plugins. If you need deep customization or extensions, Plugin Mode is the appropriate choice, because you combine and configure the plugins individually.
Setting up via plugin mode
Boards is distributed as a set of plugins. A browser editor usually registers the shared Univer runtime and the license plugin first, then the document and drawing dependencies, and finally the Board model and UI plugins.
Using package manager
The build tool must support ES Modules and the exports field in package.json.
Installation
Univer builds its UI with React and handles data streams with RxJS; it can also be embedded in Vue or Angular applications. Confirm that the react, react-dom, and rxjs peer dependencies1 are installed. The Yarn command below lists them explicitly.
Keep all @univerjs/* and @univerjs-pro/* packages on the same version.
pnpm add @univerjs/core @univerjs/design @univerjs/docs @univerjs/docs-ui @univerjs/drawing @univerjs/drawing-ui @univerjs/engine-render @univerjs/ui @univerjs-pro/license @univerjs-pro/ink-ui @univerjs-pro/shape-editor-ui @univerjs-pro/boards @univerjs-pro/boards-uinpm install @univerjs/core @univerjs/design @univerjs/docs @univerjs/docs-ui @univerjs/drawing @univerjs/drawing-ui @univerjs/engine-render @univerjs/ui @univerjs-pro/license @univerjs-pro/ink-ui @univerjs-pro/shape-editor-ui @univerjs-pro/boards @univerjs-pro/boards-uiyarn add @univerjs/core @univerjs/design @univerjs/docs @univerjs/docs-ui @univerjs/drawing @univerjs/drawing-ui @univerjs/engine-render @univerjs/ui @univerjs-pro/license @univerjs-pro/ink-ui @univerjs-pro/shape-editor-ui @univerjs-pro/boards @univerjs-pro/boards-ui react react-dom rxjsbun add @univerjs/core @univerjs/design @univerjs/docs @univerjs/docs-ui @univerjs/drawing @univerjs/drawing-ui @univerjs/engine-render @univerjs/ui @univerjs-pro/license @univerjs-pro/ink-ui @univerjs-pro/shape-editor-ui @univerjs-pro/boards @univerjs-pro/boards-uiUsage
Create the container before initializing Univer, and give it an explicit height:
<div id="app" style="height: 600px"></div>Import the facade entries used on this page before calling FUniver.newAPI(univer). Load the @univerjs/design CSS first, then the @univerjs/ui CSS, and the product CSS last.
Caution
- Register
UniverLicensePluginbefore the Board plugins. - Import shared UI CSS before product UI CSS.
- Register optional element plugins before opening a snapshot that contains those element types.
UniverBoardsUIPluginloadsUniverProFormulaEnginePluginautomatically for shapes. If the sameUniverinstance also registersUniverFormulaEnginePlugin, install@univerjs-pro/engine-formulaand replace that engine's import and registration withUniverProFormulaEnginePluginin the initialization code. Do not register both formula engines.
Import styles, locale packs, and the required plugins:
TypeScriptimport { UniverBoardsPlugin } from '@univerjs-pro/boards'import { UniverBoardsUIPlugin } from '@univerjs-pro/boards-ui'import BoardsUIEnUS from '@univerjs-pro/boards-ui/locale/en-US'import { UniverInkUIPlugin } from '@univerjs-pro/ink-ui'import InkUIEnUS from '@univerjs-pro/ink-ui/locale/en-US'import { UniverLicensePlugin } from '@univerjs-pro/license'import { LocaleType, mergeLocales, Univer, UniverInstanceType } from '@univerjs/core'import DesignEnUS from '@univerjs/design/locale/en-US'import { UniverDocsPlugin } from '@univerjs/docs'import { UniverDocsUIPlugin } from '@univerjs/docs-ui'import DocsUIEnUS from '@univerjs/docs-ui/locale/en-US'import { UniverDrawingPlugin } from '@univerjs/drawing'import { UniverDrawingUIPlugin } from '@univerjs/drawing-ui'import DrawingUIEnUS from '@univerjs/drawing-ui/locale/en-US'import { UniverRenderEnginePlugin } from '@univerjs/engine-render'import { UniverUIPlugin } from '@univerjs/ui'import UIEnUS from '@univerjs/ui/locale/en-US'import '@univerjs/design/lib/index.css'import '@univerjs/ui/lib/index.css'import '@univerjs/docs-ui/lib/index.css'import '@univerjs/drawing-ui/lib/index.css'import '@univerjs-pro/ink-ui/lib/index.css'import '@univerjs-pro/boards-ui/lib/index.css'Import the facade entry if the Facade API2 is required:
TypeScriptimport { FUniver } from '@univerjs/core/facade'import '@univerjs-pro/boards/facade'Create a Univer instance, register the plugins, and create a Board unit:
TypeScriptconst univer = new Univer({ locale: LocaleType.EN_US, locales: { [LocaleType.EN_US]: mergeLocales( DesignEnUS, UIEnUS, DocsUIEnUS, DrawingUIEnUS, InkUIEnUS, BoardsUIEnUS, ), },})univer.registerPlugin(UniverRenderEnginePlugin)univer.registerPlugin(UniverUIPlugin, { container: 'app' })univer.registerPlugin(UniverDocsPlugin)univer.registerPlugin(UniverDocsUIPlugin)univer.registerPlugin(UniverDrawingPlugin)univer.registerPlugin(UniverDrawingUIPlugin)univer.registerPlugin(UniverInkUIPlugin)univer.registerPlugin(UniverLicensePlugin, { license: process.env.CLIENT_LICENSE_TEXT,})univer.registerPlugin(UniverBoardsPlugin)univer.registerPlugin(UniverBoardsUIPlugin)univer.createUnit(UniverInstanceType.UNIVER_BOARD, {})const univerAPI = FUniver.newAPI(univer)
Plugin configuration
UniverUIPlugin
containerstring | HTMLElementElement to mount into, or its DOM ID.
UniverLicensePlugin
licensestringContents of the client license file.
univer.registerPlugin and univer.registerPlugins methods
univer.registerPlugin adds a plugin to the Univer instance. Call it after creating the instance.
The call takes the form univer.registerPlugin(Plugin, options), where Plugin is the plugin to register and options is optional configuration that varies from plugin to plugin.
univer.registerPlugins accepts an array and registers several plugins in one call, which keeps the plugin list in one place.
univer.registerPlugins([ UniverRenderEnginePlugin, [UniverUIPlugin, { container: 'app' }], UniverDocsPlugin, UniverDocsUIPlugin, UniverDrawingPlugin, UniverDrawingUIPlugin, UniverInkUIPlugin, [UniverLicensePlugin, { license: process.env.CLIENT_LICENSE_TEXT, }], UniverBoardsPlugin, UniverBoardsUIPlugin,])FUniver.newAPI(univer) returns the univerAPI object, which is Univer's Facade API. Use it to create boards and to operate on board elements.
Mobile support
These examples require SDK packages that export the mobile plugins listed below. Keep all @univerjs/* and @univerjs-pro/* dependencies on the same version.
1.0.0-rc.0 does not export UniverBoardsMobileUIPlugin. Use a build that includes this mobile entry before following the example.
For touch-oriented controls in Univer Boards, use the mobile UI plugins.3 Choose the UI mode before creating the editor.
In the plugin-mode example above, replace these UI imports and registrations before createUnit(). Do not append them to a desktop editor that has already started. Keep the model plugins, engines, locale files, CSS, and Facade imports. The desktop and mobile classes are named exports of the same package entry.
UniverMobileUIPlugin
containerstring | HTMLElementElement to mount into, or its DOM ID.disableAutoFocustrueDefault:trueStops the editor from taking focus at startup.
import { UniverBoardsMobileUIPlugin } from '@univerjs-pro/boards-ui'import { UniverDocsMobileUIPlugin } from '@univerjs/docs-ui'import { UniverDrawingMobileUIPlugin } from '@univerjs/drawing-ui'import { UniverMobileUIPlugin } from '@univerjs/ui'univer.registerPlugin(UniverMobileUIPlugin, { container: 'app' })univer.registerPlugin(UniverDocsMobileUIPlugin)univer.registerPlugin(UniverDrawingMobileUIPlugin)univer.registerPlugin(UniverBoardsMobileUIPlugin)Plugin mapping
Register only the features you use, and keep their model plugins and required dependencies. A mobile UI export does not mean that the desktop and mobile interfaces have the same controls. Pro features still require the appropriate license. If a feature needs a backend, integrate it on the application side with Univer Server SDK.
| Package | Desktop registration | Mobile registration |
|---|---|---|
@univerjs/ui | UniverUIPlugin | UniverMobileUIPlugin |
@univerjs/docs-ui | UniverDocsUIPlugin | UniverDocsMobileUIPlugin |
@univerjs/drawing-ui | UniverDrawingUIPlugin | UniverDrawingMobileUIPlugin |
@univerjs-pro/boards-ui | UniverBoardsUIPlugin | UniverBoardsMobileUIPlugin |
@univerjs/thread-comment-ui | UniverThreadCommentUIPlugin | UniverThreadCommentMobileUIPlugin |
@univerjs-pro/shape-editor-ui | UniverShapeEditorUIPlugin | UniverShapeEditorMobileUIPlugin |
@univerjs-pro/chart-ui | UniverChartUIPlugin | UniverChartMobileUIPlugin |
@univerjs-pro/exchange-client | UniverExchangeClientPlugin | UniverExchangeClientMobileUIPlugin |
@univerjs-pro/boards-chart-ui | UniverBoardsChartUIPlugin | UniverBoardsChartMobileUIPlugin |
@univerjs-pro/boards-mind-ui | UniverBoardsMindUIPlugin | UniverBoardsMindMobileUIPlugin |
@univerjs-pro/boards-resources-ui | UniverBoardsResourcesUIPlugin | UniverBoardsResourcesMobileUIPlugin |
@univerjs-pro/boards-table-ui | UniverBoardsTableUIPlugin | UniverBoardsTableMobileUIPlugin |
@univerjs-pro/boards-thread-comment-ui | UniverBoardsThreadCommentUIPlugin | UniverBoardsThreadCommentMobileUIPlugin |
Container and touch interaction
Give the container an explicit height and set up the page viewport. 100dvh follows the dynamic viewport height. Test scrolling, pinch zoom, text selection, clipboard access, and the on-screen keyboard in the target mobile browsers. Shrinking a desktop editor does not switch it to the mobile plugins.
UniverMobileUIPlugin defaults to disableAutoFocus: true, so the editor does not take focus automatically during initialization.
<meta name="viewport" content="width=device-width, initial-scale=1" /><div id="app" style="height: 100dvh"></div>Optional feature packages
Add a feature package when the Board editor needs the corresponding element type:
pnpm add @univerjs-pro/boards-table @univerjs-pro/boards-table-uipnpm add @univerjs-pro/boards-mind @univerjs-pro/boards-mind-uiFor registration examples, see Table, Mind Maps, and Import and export.
Other releases
Besides stable releases, Univer also publishes alpha and beta channels. They provide early access to features that have not shipped officially. The trade-off is higher risk: these builds may contain bugs, unfinished features, or unstable behavior. Avoid them in production whenever possible.
Alpha / beta release
When the Univer development team completes a new feature or a significant change, it may pre-release the work to the alpha or beta channel. Install an alpha or beta build of a Univer package with the following command:
pnpm add @univerjs-pro/boards@alpha # Alpha version
pnpm add @univerjs-pro/boards@beta # Beta versionnpm install @univerjs-pro/boards@alpha # Alpha version
npm install @univerjs-pro/boards@beta # Beta versionyarn add @univerjs-pro/boards@alpha # Alpha version
yarn add @univerjs-pro/boards@beta # Beta versionbun add @univerjs-pro/boards@alpha # Alpha version
bun add @univerjs-pro/boards@beta # Beta versionIf a problem occurs with an alpha or beta build, or you have feedback, report it to the Univer development team through GitHub Issues.
Next steps
Footnotes
-
peerDependenciesdeclare dependencies that the host application must provide with compatible versions. They let Univer share libraries such as React instead of bundling a separate copy. ↩ -
Facade is the application-facing API over registered plugins. Importing a Facade entry adds API methods; it does not register the feature plugin itself. ↩
-
A mobile UI plugin selects touch controls and mobile services during initialization. It does not automatically detect the device or switch an existing instance when the window is resized. To change modes, preserve the document state, dispose of the old instance and initialize the chosen plugin set. ↩
How is this guide?