The creation of custom HTML elements involves two main steps,
connectedCallback
customElements.define
class CustomElement extends HTMLElement { connectedCallback() { this.innerHTML = "This is a custom element"; } } customElements.define("custom-element", CustomElement);
<body> <custom-element> </body>