Installation & Basic Usage

Univer is built from plugins. Each feature ships as a separate module, so the same core can be assembled into electronic document applications of very different kinds. This flexibility also carries a cost: on first use, an application must determine which plugins it needs.

Univer therefore provides two ways to integrate it: plugin mode and preset mode. A preset is a bundle of plugins that has already been configured. Without complex extensions, both modes provide the same capabilities.

Caution

  • In both modes, every dependency must use the same version number.
  • If a preset already includes a plugin, do not import that plugin separately. Registering both can cause plugin conflicts or features that do not behave as expected.

The two modes differ as follows:

Plugin ModePreset Mode
Facade packages are imported manuallyFacade packages are provided by the preset
Registration order must be managed for plugins that provide the same kind of featureThe preset manages registration order for the features it includes
Plugins can be lazy-loaded on demandPresets load synchronously during initialization

For deep customization or extensions, choose plugin mode, in which each plugin is combined and configured individually. Preset mode provides a faster start because the bundle is already assembled.

Setting up via plugin mode

Univer provides its features as plugins. Some core plugins are required for the product to function, and the remaining plugins are added only when needed. The example below is a minimal Univer Docs application, assembled and installed plugin by plugin.

Unlike preset mode, plugin mode does not include the Facade API1 by default. The examples below use the Facade API, so import the corresponding facade packages before creating the API instance.

Using package manager

Installation

Univer renders its interface with React and processes its data streams with RxJS; it can also be embedded in a Vue or Angular application. Ensure that the react, react-dom, and rxjs peer dependencies2 are installed. The Yarn command below includes them explicitly.

All @univerjs/* and @univerjs-pro/* packages must use the same version.

Shell
pnpm add @univerjs/core @univerjs/design @univerjs/docs @univerjs/docs-ui @univerjs/engine-formula @univerjs/engine-render @univerjs/ui

Usage

Create the container with an explicit height before initializing Univer:

HTML
<div id="app" style="height: 600px"></div>

Import the facade entries used by the examples before calling FUniver.newAPI(univer). Load the styles in the order @univerjs/design, @univerjs/ui, then the product CSS.

Caution

  • Not every plugin includes facade packages, language packs, and style files; the documentation for each feature states which of them it provides.
  • The order of style imports matters: load the @univerjs/design and @univerjs/ui CSS before the styles of any other plugin.
  1. First, import Univer's style files, language packs, and the plugins the application requires:

    TypeScript
    import { LocaleType, mergeLocales, Univer } from '@univerjs/core'import { FUniver } from '@univerjs/core/facade'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 { UniverFormulaEnginePlugin } from '@univerjs/engine-formula'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'
  2. Next, import the facade packages used by the example:

    TypeScript
    import '@univerjs/engine-formula/facade'import '@univerjs/ui/facade'import '@univerjs/docs/facade'import '@univerjs/docs-ui/facade'
  3. Then, create a Univer instance and register these plugins:

    TypeScript
    const univer = new Univer({  locale: LocaleType.EN_US,  locales: {    [LocaleType.EN_US]: mergeLocales(      DesignEnUS,      UIEnUS,      DocsUIEnUS,    ),  },})univer.registerPlugin(UniverRenderEnginePlugin)univer.registerPlugin(UniverFormulaEnginePlugin)univer.registerPlugin(UniverUIPlugin, {  container: 'app',})univer.registerPlugin(UniverDocsPlugin)univer.registerPlugin(UniverDocsUIPlugin)const univerAPI = FUniver.newAPI(univer)univerAPI.createDocument({})

Plugin configuration

UniverUIPlugin

  • container
    string | HTMLElement
    The element into which the editor is mounted, or its DOM ID.

UniverWatermarkPlugin

  • textWatermarkSettings
    object
    Text watermark settings.
    • content
      stringDefault: ''
      Text to display.
    • fontSize
      numberDefault: 16
      Font size in pixels.

univer.registerPlugin and univer.registerPlugins methods

univer.registerPlugin registers one plugin on the Univer instance and must be called after the instance has been created.

The signature is univer.registerPlugin(Plugin, options), where Plugin is the plugin to register and options is optional configuration defined by each plugin.

To register several plugins at once, pass an array to univer.registerPlugins. This is convenient when plugins are managed in one place.

TypeScript
univer.registerPlugins([  UniverRenderEnginePlugin,  UniverFormulaEnginePlugin,  [UniverUIPlugin, {    container: 'app',  }],  UniverDocsPlugin,  UniverDocsUIPlugin,])

Lazy loading plugins

Plugin mode allows the loading time of each plugin to be controlled. A common approach loads only the essential plugins at application start and defers the remaining plugins until the first render has completed.

TypeScript
// ...const univerAPI = FUniver.newAPI(univer)univerAPI.createDocument({})import('@univerjs/watermark').then(({ UniverWatermarkPlugin }) => {  univer.registerPlugin(UniverWatermarkPlugin, {    textWatermarkSettings: {      content: 'Hello, Univer!',      fontSize: 36,    },  })})

Import from CDN

To avoid a package manager, or to evaluate Univer quickly, the resources can be loaded from a CDN. See Using Univer via CDN.

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 UniverDocsMobileUIPlugin; use a build that includes this mobile entry before running the example.

For touch controls in Univer Docs, register the mobile UI plugins.3 The UI mode must be chosen before the editor is created.

In the plugin-mode example above, replace the UI imports and registrations below, and do so before createUnit(); do not add them to a desktop editor that has already been initialized. Keep the model plugins, engines, locale files, CSS, and Facade imports unchanged. The desktop and mobile classes are named exports from the same package entry.

UniverMobileUIPlugin

  • container
    string | HTMLElement
    The element into which the editor is mounted, or its DOM ID.
  • disableAutoFocus
    trueDefault: true
    Prevents the editor from taking focus at startup.
TypeScript
import { UniverDocsMobileUIPlugin } from '@univerjs/docs-ui'import { UniverMobileUIPlugin } from '@univerjs/ui'univer.registerPlugin(UniverMobileUIPlugin, { container: 'app' })univer.registerPlugin(UniverDocsMobileUIPlugin)

UniverSheetsCorePreset and UniverDocsCorePreset currently register desktop UI plugins and provide no mobile: true option. On mobile, the plugins must be assembled individually; adding mobile plugins after a desktop preset does not replace its UI.

Plugin mapping

Register only the features that are used, and keep their model plugins and required dependencies. A mobile UI export does not imply that desktop and mobile expose the same controls. Pro features still require the appropriate license. Features that need a backend must be integrated in the application through Univer Server SDK.

PackageDesktop registrationMobile registration
@univerjs/uiUniverUIPluginUniverMobileUIPlugin
@univerjs/docs-uiUniverDocsUIPluginUniverDocsMobileUIPlugin
@univerjs/drawing-uiUniverDrawingUIPluginUniverDrawingMobileUIPlugin
@univerjs/thread-comment-uiUniverThreadCommentUIPluginUniverThreadCommentMobileUIPlugin
@univerjs-pro/shape-editor-uiUniverShapeEditorUIPluginUniverShapeEditorMobileUIPlugin
@univerjs-pro/chart-uiUniverChartUIPluginUniverChartMobileUIPlugin
@univerjs-pro/exchange-clientUniverExchangeClientPluginUniverExchangeClientMobileUIPlugin
@univerjs/docs-drawing-uiUniverDocsDrawingUIPluginUniverDocsDrawingMobileUIPlugin
@univerjs/docs-hyper-link-uiUniverDocsHyperLinkUIPluginUniverDocsHyperLinkMobileUIPlugin
@univerjs/docs-thread-comment-uiUniverDocsThreadCommentUIPluginUniverDocsThreadCommentMobileUIPlugin
@univerjs-pro/docs-callout-uiUniverDocsCalloutUIPluginUniverDocsCalloutMobileUIPlugin
@univerjs-pro/docs-chart-uiUniverDocsChartUIPluginUniverDocsChartMobileUIPlugin
@univerjs-pro/docs-code-uiUniverDocsCodeUIPluginUniverDocsCodeMobileUIPlugin
@univerjs-pro/docs-column-uiUniverDocsColumnUIPluginUniverDocsColumnMobileUIPlugin
@univerjs-pro/docs-formula-uiUniverDocsFormulaUIPluginUniverDocsFormulaMobileUIPlugin
@univerjs-pro/docs-latex-uiUniverDocsLatexUIPluginUniverDocsLatexMobileUIPlugin
@univerjs-pro/docs-list-uiUniverDocsListUIPluginUniverDocsListMobileUIPlugin
@univerjs-pro/docs-quote-uiUniverDocsQuoteUIPluginUniverDocsQuoteMobileUIPlugin
@univerjs-pro/docs-shape-uiUniverDocsShapeUIPluginUniverDocsShapeMobileUIPlugin
@univerjs-pro/docs-table-uiUniverDocsTableUIPluginUniverDocsTableMobileUIPlugin

Container and touch interaction

Set an explicit height on the container and configure the page viewport. 100dvh follows the dynamic viewport height. In the target mobile browsers, test scrolling, pinch zoom, text selection, clipboard access, and the on-screen keyboard. Resizing a desktop editor does not switch it to mobile plugins.

UniverMobileUIPlugin defaults to disableAutoFocus: true, so the editor does not take focus automatically during initialization.

HTML
<meta name="viewport" content="width=device-width, initial-scale=1" /><div id="app" style="height: 100dvh"></div>

Setting up via preset mode

Preset mode starts a Univer Docs application with fewer than twenty lines of code.

Using package manager

If the project already uses modern front-end tooling, adding Univer is straightforward. Build Univer applications with a tool that supports ES Modules well, such as Vite, esbuild, or Webpack 5. Other tools, Webpack 4 for instance, may require additional configuration.

Installation

Install @univerjs/presets with the package manager used by the project:

Shell
pnpm add @univerjs/presets @univerjs/preset-docs-core

Usage

If the build tool does not support the exports field in package.json (common in Webpack 4), the mapped paths must be changed to the actual paths manually.

The following code starts a Univer Docs application:

HTML
<div id="app" style="height: 600px"></div>
TypeScript
import { UniverDocsCorePreset } from '@univerjs/preset-docs-core'import UniverPresetDocsCoreEnUS from '@univerjs/preset-docs-core/locales/en-US'import { createUniver, LocaleType, mergeLocales } from '@univerjs/presets'import '@univerjs/preset-docs-core/lib/index.css'const { univer, univerAPI } = createUniver({  locale: LocaleType.EN_US,  locales: {    [LocaleType.EN_US]: mergeLocales(      UniverPresetDocsCoreEnUS,    ),  },  presets: [    UniverDocsCorePreset({      container: 'app',    }),  ],})univerAPI.createDocument({})

The returned univerAPI object is the Univer Facade API, and most of the functionality that Univer provides is called through it.

UniverDocsCorePreset can also be imported from @univerjs/presets/preset-docs-core, provided that the build tool supports the exports field in package.json.

Preset configuration

UniverDocsCorePreset

  • container
    string | HTMLElementDefault: 'app'
    The element into which the editor is mounted, or its DOM ID.

createUniver method

createUniver accepts a configuration object that describes the instance, including the language, theme, and plugins. It returns an object that contains the Univer instance and the Facade API instance.

The most commonly used properties are:

  • locale: the language environment, as a LocaleType enumeration value.
  • locales: language packs, keyed by language environment, each value a language pack object.
  • theme: an optional theme object.
  • presets: the presets to register, such as UniverDocsCorePreset.
  • plugins: plugins to register in addition to the presets.

Use the plugins property for a plugin that no preset package includes, or for a plugin implemented by the application. Plugins can also be registered with univer.registerPlugin after the Univer instance is obtained.

See API Reference / createUniver for the complete set of options.

Import from CDN

To avoid a package manager, or to evaluate Univer quickly, the resources can be loaded from a CDN. See Using Univer via CDN.

Other releases

Alongside the stable releases, Univer publishes alpha / beta and nightly channels, which provide early access to features that have not been officially released. More features also carry more risk: these builds may contain bugs, incomplete functionality, or unstable features. Avoid them in production environments where possible.

Alpha / beta release

When the Univer development team completes a new feature or a significant change, it may pre-release the package to the alpha or beta channel. Install an alpha or beta build with the following command:

Shell
pnpm add @univerjs/<package-name>@alpha # Alpha version
pnpm add @univerjs/<package-name>@beta # Beta version

Problems and feedback related to a pre-release can be reported to the development team through GitHub Issues. Feedback on these early builds is welcome.

Next steps

  • Basic Concepts explains the concepts that Univer is built on.
  • Features describes Univer features and how to modify document data.

Footnotes

  1. Facade is the application-facing API over registered plugins. Importing a Facade entry adds API methods; it does not register the feature plugin itself. ↩

  2. peerDependencies declare dependencies that the host application must provide with compatible versions. They let Univer share libraries such as React instead of bundling a separate copy. ↩

  3. 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?

© 2026 DreamNum Co., Ltd.