Overview

Custom Elements are a key part of the Web Components standard. They allow developers to extend HTML by creating their own tags (e.g., <my-button>) with custom logic and properties.

Types of Custom Elements

  • Autonomous Custom Elements: Standalone elements that don't inherit from standard HTML elements.
  • Customized Built-in Elements: Elements that inherit from and extend standard HTML elements (e.g., a custom <button>).

Lifecycle Callbacks

  • connectedCallback: Called when the element is added to the DOM.
  • disconnectedCallback: Called when the element is removed from the DOM.
  • attributeChangedCallback: Called when an attribute is added, removed, or updated.

Related Terms