JSFiddle - React, Tailwind, and code Playground

HTML

<x-outer></x-outer>

CSS

::part(foo) {
  color: white;
  background: steelblue;
  padding: 30px;
}
::part(inner) {
  color: red;
}

JavaScript

class Outer extends HTMLElement {
  connectedCallback() {
    this.attachShadow({ mode: 'open' });
    Promise.resolve().then(() => this.shadowRoot.innerHTML = `
      <p part="foo">Outer</p>
      <x-inner exportparts="inner, inner: foo"></x-inner>
    `);
  }
}
customElements.define('x-outer', Outer);

class Inner extends HTMLElement {
  connectedCallback() {
    this.attachShadow({ mode: 'open' });
    Promise.resolve().then(() => this.shadowRoot.innerHTML = `
      <p part="inner">Inner</p>
    `);
  }
}
customElements.define('x-inner', Inner);