Web components
Web components are browser standards for defining reusable HTML elements and giving them their own markup and styles. Different frameworks can supply values through the same element’s interface (WHATWG, n.d.e; WHATWG, n.d.a; Atkins & Daly, 2026; The React Team, 2024; Vue.js, n.d.b). Tests show interoperability for specific framework versions, and speed comparisons vary with the implementation and task (Custom Elements Everywhere, n.d.; Norrman, 2020; Ronde, 2021).
Custom elements, shadow DOM, and templates
An author defines a custom element’s behavior in JavaScript, including how the browser creates it. The browser can run a connection callback, a function invoked when the element joins the document, more than once. The author can also list which HTML attributes trigger an attribute-change callback (WHATWG, n.d.e).
Shadow DOM lets an element keep an internal tree of nodes. The element is the host, and the shadow root attaches the internal tree to it (WHATWG, n.d.a). CSS selectors, which pick the elements a style rule applies to, generally operate within one tree. Style inheritance still uses a combined tree that includes the shadow content (Atkins & Daly, 2026).
An ordinary <template> holds an HTML fragment for reuse. It has no visible output of its own. A script can copy the fragment and insert it into the document (WHATWG, n.d.f).
From v0 to declarative shadow DOM
Early Chrome versions registered custom elements with document.registerElement(), the v0 API. The v1 API uses customElements.define(). Custom elements v1 was available in Chrome 54, Safari 10.1, and Firefox 63 (Bidelman, 2017). Chrome 80 removed custom elements v0 alongside shadow DOM v0 and HTML Imports (Google, 2019a).
Declarative shadow DOM extends server rendering to a component’s internal tree. When the browser parses a template with the shadowrootmode attribute, it attaches the template content as the parent element’s shadow tree. The browser can build that tree directly from the HTML response, without JavaScript (Miller & Freed, 2024).
A slot is a place inside the shadow tree where content from outside that tree can appear. Declarative shadow DOM supports that placement in static HTML and reached all three major browser engines by August 2024 (Miller & Freed, 2024).
Framework interoperability
Frameworks can pass values to custom elements through properties on the JavaScript object or attributes on the HTML tag. In the browser, React 19 sets a property when the element exposes one with the matching name and otherwise sets an attribute (The React Team, 2024). Vue 3 also prefers a matching property. Vue’s defineCustomElement() method lets authors package Vue components as custom elements (Vue.js, n.d.b).
Custom Elements Everywhere reported that its entries for React ^19 and Vue ^3.2.38 each passed all 16 basic and all 16 advanced tests. The suite describes its cases as a proposed set of interoperability expectations (Custom Elements Everywhere, n.d.).
Forms and accessible labels
Custom elements can take part in HTML forms. An element associated with a form can tell the browser what value to submit using ElementInternals, an interface to browser features. It can also report which validity rules the input violates and supply a message (WHATWG, n.d.e).
Shadow DOM affects which nodes an accessibility label can refer to. For example, aria-labelledby supplies the ID of another element whose content labels the control. Such ARIA attributes, which describe elements for assistive technology, can name IDs only within the same tree. The corresponding JavaScript properties can refer directly to elements in a tree that contains the shadow tree (Chrome for Developers, 2026).
Chrome 152’s release notes describe an origin trial, a limited browser experiment, for a feature called Reference Target. When an ID reference points to the host, the trial feature forwards it to a designated element inside the shadow tree (Chrome Platform Status, n.d.).
A 2024 test used the VoiceOver screen reader to read a label supplied by an element with shadow content and display: contents. VoiceOver skipped that text in Safari 17.5 and read it in Firefox 126.0.1 and Chrome 125.0.6 (Rogers, 2024). WebKit lists a fix for this case in its Safari 27.0 release notes (Simmons et al., 2026).
Adoption and deployments
The 2024 Web Almanac’s JavaScript chapter found custom elements on 7.8% of desktop pages in its crawl. It reported shadow DOM on 2.51% of mobile pages in 2024 and 0.39% in 2022 (Amjad & Goel, 2025).
The Almanac’s Markup chapter reported custom elements on 3.6% of what it calls mobile sites in 2022 and 7.9% in 2024. The 2024 dataset added secondary pages alongside home pages (Franco, 2024). The figures represent comparable rates only if both years used the same page-selection rule.
Chromium’s use counter measures the daily share of browser page visits that use a feature. In 2018, roughly 5% of Chrome page views used v0 custom-element registration, including desktop YouTube visits (Chromium, n.d.c; Ito, 2018).
Named deployments include GitHub, which reported more than a dozen open-source web components in 2021 alongside dozens of closed-source ones (Oddsson, 2021). Adobe implements its Spectrum design system as web components using LitElement. Salesforce provides versions of its Lightning base components as Lightning web components and as Aura components (Adobe, n.d.b; Salesforce, n.d.).
Performance and maintainability Weak evidence: few or small studies support this
The performance evidence is limited to specific implementations and tasks. A 2020 benchmark timed operations on table rows. The Kirei web-component implementation updated them faster than the Vue implementation, and Vue created them faster (Norrman, 2020). The benchmark archive advises comparing results within a release because browser versions, processor throttling, and measurement methods change (Krause et al., n.d.).
A 2021 case study at the software company 30MHz compared its original Angular-based components with their web-component versions. The migrated JavaScript took roughly twice as long to load. A single migrated component took about 5 milliseconds longer to render (Ronde, 2021). The same case study found indications of little change in how easy the original codebase was to maintain (Ronde, 2021).
Further reading
- HTML standard on custom elements covers element definitions, lifecycle callbacks, and participation in forms (WHATWG, n.d.e).
- Declarative shadow DOM explains how a browser builds a shadow tree from an HTML response (Miller & Freed, 2024).
- Accessible web components explains where accessibility references can resolve across element trees (Chrome for Developers, 2026).
- Custom Elements Everywhere lists basic and advanced interoperability results by framework (Custom Elements Everywhere, n.d.).
First published .
Known gaps
What this article cannot tell you yet.
- It is unclear whether the Web Almanac’s 2022 and 2024 mobile custom-element figures use the same page-selection rule.
- No long-term comparison of web components and framework components is covered. The maintainability evidence here comes from one migration.
- The article gives no current estimate of the share of page visits that use custom elements.
References
- Solid source
- Rated highly trustworthy by the research, and every passage taken from it was found in it.
- Weak source
- Rated low, or a passage taken from it was not found in it.
- Medium trust
- Rated medium by the research.
- Not checked
- Rated high, but its passages could not all be checked against it.
Show all 24 references
- Adobe (n.d.b). Spectrum Web Components. Spectrum Web Components. https://opensource.adobe.com/spectrum-web-components/index.html Weak source Vendor page, read in large part.
- Amjad, A. H., & Goel, N. (2025). JavaScript. 2024 Web Almanac by HTTP Archive. https://almanac.httparchive.org/en/2024/javascript Solid source Read in large part.
- Atkins, T., & Daly, F. (2026). CSS shadow module level 1. World Wide Web Consortium. https://drafts.csswg.org/css-shadow-1/ Solid source Documentation, read in large part.
- Bidelman, E. (2017). Custom elements v1 – Reusable web components. web.dev. https://web.dev/articles/custom-elements-v1 Medium trust Documentation, read in large part.
- Custom Elements Everywhere (n.d.). Custom Elements Everywhere. Custom Elements Everywhere. https://custom-elements-everywhere.com/ Medium trust Read in large part.
- Chrome for Developers (2026). Accessible Web Components. Chrome for Developers. https://developer.chrome.com/docs/modern-web-guidance/guides/html/accessible-web-components Medium trust Documentation, read in large part.
- Chrome Platform Status (n.d.). Chrome 152 Release Notes. Chrome Platform Status. https://chromestatus.com/release-notes/152 Solid source Documentation, read in large part.
- Chromium (n.d.c). UseCounter Wiki. Chromium repository. https://raw.githubusercontent.com/chromium/chromium/main/docs/use_counter_wiki.md Solid source Documentation, read in full.
- Franco, E. (2024). Markup. 2024 Web Almanac by HTTP Archive. https://almanac.httparchive.org/en/2024/markup Medium trust Read in large part.
- Google (2019a). Chrome 80, content indexing, ES modules and more. Chromium Blog. https://blog.chromium.org/2019/12/chrome-80-content-indexing-es-modules.html Solid source Vendor page, read in large part.
- Ito, H. (2018). Intent to Deprecate and Remove: Shadow DOM V0, Custom Elements V0, HTML Imports. blink-dev. https://groups.google.com/a/chromium.org/g/blink-dev/c/h-JwMiPUnuU/m/8yiBD1SWAwAJ Medium trust Read in large part.
- Krause, S., et al. (n.d.). JavaScript Framework Benchmark. JavaScript Framework Benchmark. https://krausest.github.io/js-framework-benchmark/ Solid source Read in large part.
- Miller, J., & Freed, M. (2024). Declarative shadow DOM. web.dev. https://web.dev/articles/declarative-shadow-dom Medium trust Documentation, read in large part.
- Norrman, C. (2020). Building a front-end framework with Web Components: A study about the next generation of front-end frameworks. Blekinge Institute of Technology. https://www.diva-portal.org/smash/get/diva2%3A1439498/FULLTEXT02.pdf Medium trust Read in large part.
- Oddsson, K. (2021). How we use Web Components at GitHub. The GitHub Blog. https://github.blog/engineering/architecture-optimization/how-we-use-web-components-at-github/ Weak source Vendor page, read in large part.
- The React Team (2024). React v19. React. https://react.dev/blog/2024/12/05/react-19 Solid source Documentation, read in large part.
- Rogers, K. (2024). AX: Elements with display: contents and content in a shadowroot do not have their content read when referenced by aria-labelledby. WebKit Bugzilla. https://bugs.webkit.org/show_bug.cgi?id=275222 Medium trust Read in large part.
- Ronde, S. (2021). Migrating Angular-based web apps to Web Components - A case study at 30MHz. Vrije Universiteit Amsterdam and Universiteit van Amsterdam. https://www.sanderron.de/thesis.pdf Medium trust Read in large part.
- Salesforce (n.d.). Get Started with Lightning Web Components. Lightning Web Components Developer Guide. https://developer.salesforce.com/docs/platform/lwc/guide/get-started-introduction Solid source Documentation, read in large part.
- Simmons, J., et al. (2026). WebKit Features for Safari 27.0. WebKit. https://webkit.org/blog/18325/webkit-features-for-safari-27-0/ Medium trust Documentation, read in large part.
- Vue.js (n.d.b). Vue and web components. Vue.js. https://vuejs.org/guide/extras/web-components Solid source Documentation, read in large part.
- WHATWG (n.d.a). DOM standard. WHATWG. https://dom.spec.whatwg.org/ Solid source Documentation, read in large part.
- WHATWG (n.d.e). HTML standard: Custom elements. WHATWG. https://html.spec.whatwg.org/multipage/custom-elements.html Solid source Documentation, read in large part.
- WHATWG (n.d.f). HTML standard: Scripting. WHATWG. https://html.spec.whatwg.org/multipage/scripting.html Solid source Documentation, read in large part.