IT lexicon › Web › Custom Elements

Custom Elements

Web På svenska → Updated: 2026-07-30

Browser API for creating your own HTML tags — customElements.define('my-button', class extends HTMLElement {...}).

v1 spec (2018). Must contain a hyphen (so it doesn't clash with future standard tags). Lifecycle: connectedCallback, disconnectedCallback, attributeChangedCallback, adoptedCallback. Form-Associated Custom Elements (2022): can be part of <form> data, validate, submit. Polyfills exist but no modern browsers need them.

← Back to the lexicon