Declarative
Buttons with paneltarget="id" open a <section panel> with that id. No JS required.
The contents of the section become the panel body. When the panel closes, the contents are returned to the section.
<button paneltarget="inspector" paneltargetaction="toggle">Inspector</button>
<section id="inspector" panel
panel-title="Inspector"
panel-width="320" panel-height="280"
panel-draggable panel-resizable panel-closable
panel-focusable panel-stackable panel-titled panel-escapable>
<p>Anything inside this section becomes the panel body.</p>
</section>