General API
The root Facade API combines the common Univer runtime with the Slides plugins registered by this application. This page covers commands, events, history, and unit lifecycle without assuming experience with another Univer document type. For presentation objects, continue with Univer Slides API.
Create the API object
Create one FUniver wrapper after the Univer instance and required plugins are registered:
import { FUniver } from '@univerjs/core/facade'const univerAPI = FUniver.newAPI(univer)Facade entries imported before this call extend the same object with Slides methods.
Commands
executeCommand() runs a registered command asynchronously. Use syncExecuteCommand() only when that command explicitly supports synchronous execution. Facade methods remain the preferred entry point for common Slides operations.
Events
const commandLog = univerAPI.addEvent( univerAPI.Event.CommandExecuted, ({ id }) => console.log('Executed:', id))// Later, remove the listener.commandLog.dispose()Use BeforeCommandExecute when an application must inspect or cancel a command. LifeCycleChanged reports when the editor reaches stages such as Rendered and Steady.
Undo and redo
Undo and redo act on the currently focused Univer unit and return promises:
await univerAPI.undo()await univerAPI.redo()Slides Facade mutations use the command pipeline, so supported changes participate in the same history.
System clipboard
With UniverSlidesUIPlugin registered and the Slides canvas focused, copy() copies the current selection and paste() inserts clipboard content through the Slides UI commands.
import '@univerjs/ui/facade'await univerAPI.copy()await univerAPI.paste()On the canvas, the context menu supports normal paste, paste as text, and paste as image. Text mode creates an editable text box from clipboard text. Image mode uses image files or image resources available in clipboard HTML; it does not render arbitrary clipboard content into an image.
While editing shape or table text, the text editor provides Keep source formatting, Match destination formatting, and Keep text only, including a formatting menu after pasting.
These operations require a focused browser editor and clipboard permissions; they are unavailable in a model-only Node.js runtime. If browser clipboard reading is blocked, use the system paste shortcut.
UI
The UI Facade can show messages, open dialogs or sidebars, register components, and control built-in UI parts:
univerAPI .showMessage({ content: 'Presentation saved', type: 'success' }) .setUIVisible(univerAPI.Enum.BuiltInUIPart.TOOLBAR, true)These methods require UniverUIPlugin; Slides-specific editing controls additionally require UniverSlidesUIPlugin.
WebSocket
WebSocket support is optional and comes from the Network Facade:
import { UniverNetworkPlugin } from '@univerjs/network'import '@univerjs/network/facade'univer.registerPlugin(UniverNetworkPlugin)const socket = univerAPI.createSocket('wss://example.com/slides')socket.open$.subscribe(() => socket.send('ready'))Message protocols, authentication, reconnection, and collaboration conflict handling remain the host application’s responsibility.
Enums
univerAPI.Enum exposes common runtime enums plus those added by Slides:
const lifecycle = univerAPI.Enum.LifecycleStages.Steadyconst transition = univerAPI.Enum.SlideTransitionTypeEnum.Fadeconst elementType = univerAPI.Enum.SlidePageElementTypeEnum.ShapeUtilities
univerAPI.Util exposes shared helpers such as number formatting, rectangle operations, and common tools:
const payload = univerAPI.Util.tools.deepClone({ slideId: 'slide-1', selectedElementIds: ['element-1'],})How is this guide?