JSFiddle - React, Tailwind, and code Playground

HTML

<custom-dialog id="cd">
  <template shadowrootmode="open">
    <dialog id="dialog">
      Dialog Content
    </dialog>
  </template>
</custom-dialog>

<button command="show-modal" id="button">
  Show Modal
</button>

JavaScript

button.commandForElement = cd.shadowRoot.firstElementChild;