Core Features

Univer Docs consists of a document editor, a formula engine, a rendering engine, a design system, and a UI component library. Together they form a document processing platform that supports multiple document formats and complex operations.

Features

  • Document rendering. Univer Docs renders the document content, the cursor, and the selection.
  • Document typesetting. Full-text typesetting covers paragraph settings: spacing before and after a paragraph, alignment, indentation, and hanging indent. Within a paragraph, it also covers punctuation compression, hanging punctuation, character spacing, and Western word breaking.
  • Formula calculation. Univer Docs supports adding and calculating Univer formulas. This capability is still in development.
  • Tables. Univer Docs supports inserting basic tables and editing them, including adding or deleting rows and editing cells.
  • Document styles. Univer Docs supports both traditional document styles similar to Microsoft Word (pagination, headers, and footers) and modern document styles similar to Notion. Modern documents do not paginate: content expands without limit, and official or third-party block-level elements, such as text, images, and tables, can be mixed in the same document (planned).
  • Headers and footers. Univer Docs supports inserting a header or footer and editing its content. First pages and odd/even pages can differ (traditional documents only).
  • Lists. Univer Docs supports inserting and editing ordered, unordered, and task lists, and indenting or outdenting them.
  • Emoji and symbols. Emoji and symbols can be inserted from the Docs ribbon.
  • Plugin system. Univer Docs supports custom plugins, such as formula, image, and chart plugins. The plugin system is also one of Univer's core architectural capabilities.

Plugin mode

Installation

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

Usage

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/lib/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/docs/facade'import '@univerjs/docs-ui/facade'import '@univerjs/design/lib/index.css'import '@univerjs/ui/lib/index.css'import '@univerjs/docs-ui/lib/index.css'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

@univerjs/core

The core library provides the Univer constructor, together with themes and languages.

TypeScript
import type { IUniverConfig } from '@univerjs/core'import { LocaleType, Univer } from '@univerjs/core'const config: IUniverConfig = {  locale: LocaleType.EN_US,  darkMode: false,}const univer = new Univer(config)

Reference: IUniverConfig

@univerjs/engine-render

The rendering engine is responsible for rendering, scrollbars, the cursor, and the selection. It is registered as UniverRenderEnginePlugin.

Reference: @univerjs/engine-render

@univerjs/engine-formula

The formula engine calculates and processes formulas. It is registered as UniverFormulaEnginePlugin.

Reference: @univerjs/engine-formula

@univerjs/design

The design system provides the base components and styles.

See: UI Chapter

@univerjs/ui

The UI foundation plugin is registered as UniverUIPlugin.

UniverUIPlugin accepts options that configure the basic layout.

  • container
    string | HTMLElement
    Element in which the editor is mounted.
  • header
    booleanDefault: true
    Show the header.
  • toolbar
    booleanDefault: true
    Show the toolbar.
  • ribbonType
    RibbonTypeDefault: 'classic'
    Choose the Ribbon layout.
  • contextMenu
    booleanDefault: true
    Enable context menus.
  • disableAutoFocus
    true
    Disable autofocus at startup.
  • menu
    Record<string, object>
    Order, placement and visibility of menu items.
    • [id]
      object
      An override for this menu item, Ribbon tab, or Ribbon group.
  • override
    [DependencyIdentifier, Provider | null][]
    Override injected dependencies.
    • [0]
      DependencyIdentifier
      Dependency identifier to replace.
    • [1]
      Provider | null
      Replacement provider. Pass null to remove the dependency.

Use menu to show, hide, or otherwise change the state of specific menu items:

TypeScript
univer.registerPlugin(UniverDocsUIPlugin, {  menu: {    'doc.command.set-inline-format-bold': {      hidden: true,    },    'doc.command.set-inline-format-italic': {      hidden: true,      disabled: true,    },  },})

'doc.command.set-inline-format-bold' and 'doc.command.set-inline-format-italic' are command names that identify the corresponding menu items.

Reference: @univerjs/docs-ui

@univerjs/docs

The core Docs plugin is registered as UniverDocsPlugin.

Reference: @univerjs/docs

@univerjs/docs-ui

The Docs UI plugin contains the document editor's UI components and interactions. It is registered as UniverDocsUIPlugin.

Reference: @univerjs/docs-ui

  • toc
    boolean
    Show the document outline. When omitted, Modern documents show it and Traditional documents hide it.
  • menu
    Record<string, object>
    Order, placement and visibility of menu items.
    • [id]
      object
      An override for this menu item, Ribbon tab, or Ribbon group.
      • order
        number
        Position among siblings. Lower values come first.
      • hidden
        boolean
        Hide the item.
      • disabled
        boolean
        Disable the item.
      • activated
        boolean
        Show the item as active.
      • title
        string
        Title or translation key.
      • tooltip
        string
        Tooltip or translation key.
      • icon
        string | Observable<string>
        Icon name or observable icon name.
      • type
        MenuItemType
        Menu presentation: button, selector, button selector, or submenu.
      • commandId
        string
        Command invoked by the item.
      • description
        string
        Description of the item.
      • slot
        boolean
        Reserve a slot for custom rendering.
      • label
        string | object
        Specify the label or a custom label component.
      • params
        Record<string, unknown> | (() => Record<string, unknown> | undefined)
        Parameters passed to the command, or a function that supplies them.
      • gridLayout
        object
        Placement in the grid Ribbon.
        • row
          1 | 2
          Row 1 or 2 in the group.
        • column
          number
          Column in the group, starting at 1.
        • rowSpan
          1 | 2Default: 1
          Number of rows occupied.
        • columnSpan
          numberDefault: 1
          Number of columns occupied.
        • showLabel
          booleanDefault: false
          Show the title beside the icon.
        • width
          number
          Control width in pixels.
        • minWidth
          number
          Minimum width in pixels before the group moves into More.
        • iconSize
          number
          Icon size in pixels.

Preset mode

Installation

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

Usage

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()],})univerAPI.createDocument({})

Preset configuration

@univerjs/presets

This preset provides createUniver for creating a Univer application and re-exports every method and object from @univerjs/core and @univerjs/design.

createUniver accepts a configuration object that covers theme, language, presets, and other options. It returns a Univer instance univer and an FUniver instance univerAPI for calling the Facade API.

  • theme
    ThemeDefault: defaultTheme
    Theme used by the editor.
    • [palette]
      object
      • [shade]
        string
        Color palette keyed by name and shade. Use defaultTheme as the template.
  • darkMode
    booleanDefault: false
    Start in dark mode.
  • locale
    LocaleType
    Language used by menus and dialogs.
  • region
    LocaleTypeDefault: locale
    Region used for formatting.
  • locales
    Record<string, ILanguagePack>
    Translations keyed by locale.
    • [locale]
      ILanguagePack
      Translations for one locale. Use the locale value as the key.
  • logLevel
    LogLevelDefault: LogLevel.WARN
    Verbosity of runtime logs.
  • presets
    (IPreset | [IPreset, IPresetOptions])[]
    Presets to register.
    • [0]
      IPreset
      Preset returned by a preset factory.
    • [1]
      IPresetOptions
      Defers registration of this preset’s plugins.
      • lazy
        boolean
        Defers registration of this preset’s plugins.
    • lazy
      boolean
      Defers registration of this preset’s plugins.
  • plugins
    (PluginCtor | [PluginCtor, object])[]
    Additional plugins and their options.
    • [0]
      PluginCtor
      Plugin constructor.
    • [1]
      object
      Options accepted by that plugin’s constructor.

Reference: createUniver

@univerjs/preset-docs-core

This is the core preset for Univer Docs. It bundles the core capabilities that an electronic document requires, such as the document editor, formula engine, and rendering engine.

  • container
    string | HTMLElementDefault: 'app'
    Element where the editor mounts.
  • header
    booleanDefault: true
    Show the header.
  • toolbar
    booleanDefault: true
    Show the toolbar.
  • ribbonType
    RibbonTypeDefault: 'classic'
    Choose the Ribbon layout.
  • contextMenu
    booleanDefault: true
    Enable context menus.
  • disableAutoFocus
    true
    Disable autofocus at startup.
  • menu
    Record<string, object>
    Order, placement and visibility of menu items.
    • [id]
      object
      An override for this menu item, Ribbon tab, or Ribbon group.
  • toc
    boolean
    Show the document outline. When omitted, Modern documents show it and Traditional documents hide it.

Use menu to show, hide, or otherwise change the state of specific menu items:

TypeScript
UniverDocsCorePreset({  menu: {    'doc.command.set-inline-format-bold': {      hidden: true,    },    'doc.command.set-inline-format-italic': {      hidden: true,      disabled: true,    },  },})

'doc.command.set-inline-format-bold' and 'doc.command.set-inline-format-italic' are command names that identify the corresponding menu items.

Reference: @univerjs/preset-docs-core

Viewing controls

The View ribbon contains page settings, zoom, and fullscreen controls. The zoom selector and the zoom bar at the bottom show the same document view scale. Changing that scale does not change text formatting.

Define a shared MenuConfig with Docs menu IDs, then apply it for the integration mode in use:

TypeScript
import type { MenuConfig } from '@univerjs/ui'const menu: MenuConfig = {  'ribbon.start.format': { order: -1 },  'doc.command.set-inline-format-bold': {    order: 0,    gridLayout: { row: 2, column: 2 },  },  'doc.command.set-inline-format-italic': {    gridLayout: { row: 2, column: 1 },  },}

Merge these options into the existing initialization for the integration mode in use. Retain the other plugin, locale, theme, and container settings, and do not register the same plugin twice.

TypeScript
import { UniverUIPlugin } from '@univerjs/ui'univer.registerPlugin(UniverUIPlugin, {  ribbonType: 'grid',  menu,})

Document outline

The outline on the left navigates between headings. It does not insert a table of contents into the document. When toc is omitted, Modern documents show the outline and Traditional documents hide it. An explicit true or false overrides either default. The panel collapses when space is insufficient or a table overlaps it, and reopens when space is available.

Merge this option into the existing initialization, and do not register the same plugin twice.

TypeScript
import { UniverDocsUIPlugin } from '@univerjs/docs-ui'univer.registerPlugin(UniverDocsUIPlugin, { toc: true })

After initialization, call updateMenuConfig() on the existing instance:

TypeScript
import '@univerjs/ui/facade'univerAPI.updateMenuConfig(menu)

order sorts siblings from lowest to highest. gridLayout applies only to the grid Ribbon and uses 1-based coordinates within each two-row group. Runtime updates preserve properties that were not specified and refresh the UI immediately. In plugin mode, pass menu to UniverUIPlugin, and import @univerjs/ui/facade before calling the Facade. The menu layout guide covers grid fields and custom buttons.

Paste options

Docs provides three paste modes: keep source formatting, match destination formatting, and keep text only. Match destination formatting adopts the target text and paragraph styles while keeping supported emphasis such as bold and italic. Text-only paste removes images and hyperlinks, and table content becomes tab-separated text. The post-paste options apply to the most recent paste. If the browser blocks clipboard reads, use the keyboard shortcut or the system paste command.

On desktop, the Ribbon Paste dropdown is located beside undo and redo, and it is hidden while editing shape text. The Paste special submenu is in the formatting group of the context menu on both desktop and mobile.

In traditional documents, editing a header or footer opens a contextual Ribbon with insertion and navigation controls, first-page and odd/even-page options, and positioning settings. The Ribbon can insert current-page and total-page fields, or a localized date and time. Page fields show the value for each rendered page. For date and time, enable automatic updating to store a field, and disable it to insert fixed text. Date and time fields refresh when the document opens or when Update fields is selected, and they do not update continuously. Modern documents do not use page headers or footers.

Collapse heading sections

Modern documents (documentStyle.documentFlavor: DocumentFlavor.MODERN) show a triangle beside Heading 1–5 when the heading has section content. Collapsing keeps the heading visible and hides everything up to the next heading of the same or higher level, including nested headings, tables, and images. Each table cell and Modern column has its own heading hierarchy.

Collapse behavior is independent of toc. Traditional documents and embedded text editors do not show collapse controls. Expanding a parent heading preserves the collapse state of its nested headings.

Heading collapse illustration

Fold the nested heading, then fold and reopen its parent. The nested section stays folded.

Headings organize text, tables, and images into sections.

Collapse state is saved with the document and shared with collaborators.

Export and reuse

A heading at the same level starts a new section and remains visible.

IParagraph.headingCollapsed is stored in the Univer snapshot, and only true collapses a section. Content remains in the snapshot, and the state participates in undo/redo and collaboration, so other editors see it. A selection inside hidden content moves to the visible heading. Preservation through Office import and export is not guaranteed.

For programmatic changes, call the registered command with the document ID and a stable paragraphId from the snapshot. Setting collapsed: false expands the section.

TypeScript
import { SetHeadingCollapsedCommand } from '@univerjs/docs'const changed = await univerAPI.executeCommand(SetHeadingCollapsedCommand.id, {  unitId: documentId,  paragraphId: headingParagraphId,  collapsed: true,})

The command returns false for an unchanged state or an invalid target, including a Traditional document, a heading hidden by an ancestor, an empty section when collapsing, or missing edit permission. See the command contract.

How is this guide?

© 2026 DreamNum Co., Ltd.