GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • MDN
  • HTML: Markup language
  • Elements
  • Global attributes
  • Attributes
  • See all…
  • Responsive images
  • HTML cheatsheet
  • Date & time formats
  • See all…
  • SVG
  • MathML
  • XML
  • CSS: Styling language

This view

  • Original page
  • New address

GeezerVison is showing developer.mozilla.org — Window: customElements property - Web APIs | MDN

Window: customElements property

Baseline
Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since January 2020.

  • See full compatibility
  • Learn more

The customElements read-only property of the Window interface returns a reference to the global CustomElementRegistry object, which can be used to register new custom elements and get information about previously registered custom elements.

The global registry is used for registering custom elements by default, but a shadow root can choose to use a scoped custom element registry in order to avoid potential clashes in defined element names.

Value

A CustomElementRegistry.

Examples

Basic usage

The most common example you'll see of this property being used is to get access to the CustomElementRegistry.define() method to define and register a new custom element.

For example:

js
let customElementRegistry = window.customElements;
customElementRegistry.define("my-custom-element", MyCustomElement);

Note that the custom element class is commonly defined directly inside the define() call, as shown:

js
customElements.define(
  "element-details",
  class extends HTMLElement {
    constructor() {
      super();
      const template = document.getElementById("element-details-template");
      const shadowRoot = this.attachShadow({ mode: "open" }).appendChild(
        document.importNode(template.content, true),
      );
    }
  },
);

See our web-components-examples repo for more usage examples.

Specifications

Specification
HTML
# dom-window-customelements

Browser compatibility

Help improve MDN

Learn how to contribute

This page was last modified on Apr 6, 2026 by MDN contributors.

View this page on GitHub • Report a problem with this content
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.