API Reference

Embed

Packages@univerjs-pro/embed

The Embed Facade API creates and manages references between Univer units. Import the package facade before using these APIs.

TypeScript
import '@univerjs-pro/embed/facade'

FUniver APIs

MethodDescription
createEmbed(params)Create an embed descriptor and its host anchor.
getEmbed(params)Get an embed by its host unit and embed ID.
listEmbeds(params?)List active embeds, optionally limited to one host unit.
removeEmbed(params)Remove an embed by its host unit and embed ID.
loadUnitAsync(ref, options?)Load a referenced unit into the current runtime.

Create and load an embed

The host unit must already be registered in the current runtime. The required context fields depend on the selected host surface.

TypeScript
const embed = univerAPI.createEmbed({  embedId: 'doc-in-sheet',  host: {    unitId: 'host-workbook-id',    surface: univerAPI.Enum.FEmbedHostSurface.SheetFloating,    context: {      subUnitId: 'host-sheet-id',      left: 80,      top: 80,      width: 640,      height: 360,    },  },  content: {    unitType: univerAPI.Enum.UniverInstanceType.UNIVER_DOC,    ref: '#unit=embedded-document-id&type=doc',  },})const document = await embed.loadAsync()

For a known resource reference, load the unit without creating an embed:

TypeScript
const document = await univerAPI.loadUnitAsync(  '#unit=embedded-document-id&type=doc',  { unitType: univerAPI.Enum.UniverInstanceType.UNIVER_DOC },)

FEmbed APIs

MethodDescription
getId()Get the ID that is unique within the host unit.
getHostUnitId() / getHostAnchorId()Get the owning unit and host anchor IDs.
getChildUnitId()Get the locally materialized child unit ID, if available.
getHostType() / getChildType()Get the Univer instance types of the host and child units.
getEntry()Get the host entry used to place the embed.
getDescriptor()Get a copy of the embed descriptor.
loadAsync(options?)Materialize and load the referenced child unit.
remove()Remove this embed from its host unit.

Host surfaces

Use univerAPI.Enum.FEmbedHostSurface to choose the host placement:

ValueHost placement
DocBlockDocument custom block
SheetTabSheet tab
SheetFloatingFloating object in a sheet
BaseTableBase table-list block
SlidePageSlide page-list block
SlideFloatingFloating object in a slide
BoardFloatingFloating object on a board
Source: @univerjs-pro/embed/facade

How is this guide?

© 2026 DreamNum Co., Ltd.