Skip to content

Function: createSkillMountRoot()

ts
function createSkillMountRoot(options: {
  identifier: string;
  onDestroy: (reactMountRoot: HTMLElement) => any;
}): HTMLDivElement;

Defined in: src/assistant-api-utils/createSkillMountRoot.ts:80

Create a mount root element for rendering skill UI. Use Shadow DOM in production and regular DOM in test mode.

Parameters

ParameterTypeDescription
options{ identifier: string; onDestroy: (reactMountRoot: HTMLElement) => any; }Configuration with an identifier string and an onDestroy callback.
options.identifierstring-
options.onDestroy(reactMountRoot: HTMLElement) => any-

Returns

HTMLDivElement

The React mount root element.

Example

ts
const root = createSkillMountRoot({
  identifier: 'invoice-processor',
  onDestroy: (el) => console.log('Skill unmounted'),
});

Matterway Assistant SDK Documentation