Can I use native web components with CSUI?

I tried using Content Scripts UI (CSUI) with a native web component instead of a react component (see below), but I got a bunch of React errors in the browser console referring to a React component. Is there a way to make Plasmo work with native web components or something like Lit? Thanks.

import type { PlasmoCSConfig, PlasmoGetInlineAnchor } from "plasmo"

export const config: PlasmoCSConfig = {
  matches: ["https://www.plasmo.com/*"],
  world: "MAIN"
}

export const getInlineAnchor: PlasmoGetInlineAnchor = () =>
  document.querySelector(`[href="/#pricing"]`)

// Use this to optimize unmount lookups
export const getShadowHostId = () => "plasmo-inline-example-unique-id"

class PlasmoInline extends HTMLElement {
  constructor() {
    super();

    const container = document.createElement('div');
    container.style.borderRadius = '4px';
    container.style.padding = '4px';
    container.style.background = 'pink';
    container.textContent = 'CSUI INLINE';

    // Append directly to the element without shadow DOM
    this.appendChild(container);
  }
}

// Define the custom element
customElements.define('plasmo-inline', PlasmoInline);

export default PlasmoInline
Was this page helpful?