Skip to content

Latest commit

 

History

History
49 lines (34 loc) · 1.72 KB

File metadata and controls

49 lines (34 loc) · 1.72 KB

@univerjs/ui-adapter-web-component

npm version license downloads

@univerjs/ui-adapter-web-component adapts Univer UI services for Web Component integrations.

Package Overview

Package UMD global CSS Locales Facade entry
@univerjs/ui-adapter-web-component UniverUiAdapterWebComponent No No No

Installation

pnpm add @univerjs/ui-adapter-web-component
# or
npm install @univerjs/ui-adapter-web-component

Keep all @univerjs/* packages on the same version.

Usage

import { UniverWebComponentAdapterPlugin } from '@univerjs/ui-adapter-web-component';

univer.registerPlugin(UniverWebComponentAdapterPlugin);

Register custom elements with the web-component framework option. Runtime props are assigned to the created element as DOM properties, which supports object values such as data and extraProps.

class MyPopup extends HTMLElement {
    set data(value) {
        this.textContent = value?.label ?? '';
    }
}

univerAPI.registerComponent('my-popup', MyPopup, { framework: 'web-component' });

Resources