Skip to content

Function: addStyles()

ts
function addStyles(target: HTMLElement | ShadowRoot, elementId?: string): void;

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

Copy style tags from the document head into a target ShadowRoot or HTMLElement.

Parameters

ParameterTypeDescription
targetHTMLElement | ShadowRootThe ShadowRoot or HTMLElement to receive the styles.
elementId?stringOptional ID of an iframe element whose styles to copy.

Returns

void

Example

ts
const shadowRoot = element.attachShadow({ mode: 'open' });
addStyles(shadowRoot, 'matterway-skill-styles');

Matterway Assistant SDK Documentation