Core Features
Univer Slides core consists of a presentation model and the browser editing UI. The model stores a presentation as an ISlideData snapshot, and the UI renders that model and modifies it through Univer commands.
Features
- The presentation model maintains the presentation identity, page size, slide order, slides, master pages, layout pages, themes, transitions, and resources.
- Rendering and editing cover the slide canvas, thumbnails, selection, clipboard, text and shape editing, alignment guides, and presentation playback.
- Changes to pages and elements are applied through commands and mutations, so model updates, rendering, and undo and redo stay synchronized.
- The Facade API creates and locates presentations, saves snapshots, and exposes slide and element operations as objects that the application can call.
- Optional features such as tables, charts, printing, and import/export remain outside the core stack as plugins.
Plugin mode
Installation
pnpm add @univerjs/core @univerjs/design @univerjs/docs @univerjs/docs-ui @univerjs/drawing @univerjs/engine-render @univerjs/ui @univerjs-pro/license @univerjs-pro/slides @univerjs-pro/slides-uinpm install @univerjs/core @univerjs/design @univerjs/docs @univerjs/docs-ui @univerjs/drawing @univerjs/engine-render @univerjs/ui @univerjs-pro/license @univerjs-pro/slides @univerjs-pro/slides-uiyarn add @univerjs/core @univerjs/design @univerjs/docs @univerjs/docs-ui @univerjs/drawing @univerjs/engine-render @univerjs/ui @univerjs-pro/license @univerjs-pro/slides @univerjs-pro/slides-uibun add @univerjs/core @univerjs/design @univerjs/docs @univerjs/docs-ui @univerjs/drawing @univerjs/engine-render @univerjs/ui @univerjs-pro/license @univerjs-pro/slides @univerjs-pro/slides-uiUsage
import { UniverLicensePlugin } from '@univerjs-pro/license'import { UniverSlidesPlugin } from '@univerjs-pro/slides'import { UniverSlidesUIPlugin } from '@univerjs-pro/slides-ui'import SlidesUIEnUS from '@univerjs-pro/slides-ui/locale/en-US'import SlidesEnUS from '@univerjs-pro/slides/locale/en-US'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 { UniverDrawingPlugin } from '@univerjs/drawing'import { UniverRenderEnginePlugin } from '@univerjs/engine-render'import { UniverUIPlugin } from '@univerjs/ui'import UIEnUS from '@univerjs/ui/locale/en-US'import '@univerjs-pro/slides/facade'import '@univerjs/design/lib/index.css'import '@univerjs/ui/lib/index.css'import '@univerjs/docs-ui/lib/index.css'import '@univerjs-pro/slides-ui/lib/index.css'const univer = new Univer({ locale: LocaleType.EN_US, locales: { [LocaleType.EN_US]: mergeLocales(DesignEnUS, UIEnUS, DocsUIEnUS, SlidesEnUS, SlidesUIEnUS), },})univer.registerPlugin(UniverRenderEnginePlugin)univer.registerPlugin(UniverUIPlugin, { container: 'app' })univer.registerPlugin(UniverDocsPlugin)univer.registerPlugin(UniverDocsUIPlugin)univer.registerPlugin(UniverDrawingPlugin)univer.registerPlugin(UniverLicensePlugin, { license: process.env.CLIENT_LICENSE_TEXT,})univer.registerPlugin(UniverSlidesPlugin)univer.registerPlugin(UniverSlidesUIPlugin)const univerAPI = FUniver.newAPI(univer)const presentation = univerAPI.createPresentation({ name: 'Quarterly review' })Plugin configuration
UniverLicensePlugin
licensestringClient license file contents.
UniverSlidesUIPlugin
editorobjectEnable the PDF editor or the Slides editor controls.enabledbooleanDefault:trueEnable the PDF editor or the Slides editor controls.
To render a presentation without editing controls, set UniverSlidesUIPlugin to { editor: { enabled: false } }. In a Node.js process, register UniverSlidesPlugin without the UI plugin.
Menu order and grid layout
UniverUIPlugin
containerstring | HTMLElementMount element or its DOM ID.ribbonTypeRibbonTypeDefault:classicChoose the Ribbon layout.
Set menu and ribbonType in the existing UniverUIPlugin registration. Both are shared UI options and do not belong to UniverSlidesUIPlugin. The following example uses menu IDs from Slides:
import type { MenuConfig } from '@univerjs/ui'import { UniverUIPlugin } from '@univerjs/ui'const menu: MenuConfig = { 'ribbon.view': { order: -1 }, 'ribbon.start.layout': { order: -1 }, 'slide.menu.insert.text': { order: 1, gridLayout: { row: 1, column: 2, rowSpan: 2, showLabel: true, width: 96 }, }, 'slide.menu.insert.shape': { order: 0, gridLayout: { row: 1, column: 1, rowSpan: 2, showLabel: true }, },}univer.registerPlugin(UniverUIPlugin, { container: 'app', ribbonType: 'grid', menu })order sorts sibling tabs, groups, or menu items in ascending order. It does not move an item into another group. Use the actual menu item ID, which is available from the data-u-command attribute, rather than assuming that it matches the command ID.
Preset mode
Univer Slides does not provide a preset package yet. Use Plugin Mode both to run the model alone and to build the browser editor.
Ribbon organization
The Start tab contains the theme, transition, background, and speaker-note controls. The Insert tab gathers content insertion and the object list. The View tab provides page size, zoom, and fullscreen. The contextual format tab follows the selection: a selected shape shows shape formatting, a selected image shows image formatting, a selected chart shows chart formatting, and a mixed selection that includes images or charts shows the common object controls. The image tab covers crop and clip shape, size, position, and rotation, and some of these controls require a single image. Table selections use the controls supplied by the table UI plugin. Shape formatting also has a separate floating-toolbar toggle.
Update menus with the Facade API
Runtime updates
Import @univerjs/ui/facade before creating univerAPI with FUniver.newAPI(univer). updateMenuConfig() merges the changes into the existing configuration, preserves the fields that are not specified, and refreshes the menus. The overrides also apply to menus registered later.
import '@univerjs/ui/facade'univerAPI.updateMenuConfig({ 'slide.menu.insert.text': { gridLayout: { row: 1, column: 2, width: 120 } },})gridLayout affects only the grid Ribbon. Every group has two rows, and row and column start at 1. An explicit position takes precedence over the visual ordering by order, so when two occupied cells are swapped, both items must be updated. Optional fields inherit the existing configuration or schema. Spans, labels, widths, and icon sizes belong to IRibbonGridLayout.
Keep editing enabled in UniverSlidesUIPlugin. With editor.enabled: false, the Ribbon for this product is never registered, and menu overrides cannot add the missing buttons.
Custom buttons and submenu triggers follow the same rules. createMenu() and createSubmenu() also accept order and gridLayout, and appendTo() registers them. The contents of the popup do not use the Ribbon grid layout.
Commit text before saving
When @univerjs-pro/slides-ui/facade is loaded, a custom toolbar or dialog should call await presentation.endTextEditingAsync() before saving a snapshot. Save only after the call resolves to true. A return value of false means that the draft could not be committed or that IME composition is still in progress.
How is this guide?