A Web Component is a custom HTML element, defined once, with genuine style and DOM encapsulation via the Shadow DOM - meaning its internal CSS can't leak out, and the page's CSS can't accidentally leak in.

class PriceTag extends HTMLElement {
  connectedCallback() {
    const cents = this.getAttribute('cents');
    this.innerHTML = `$${(cents / 100).toFixed(2)}`;
  }
}
customElements.define('price-tag', PriceTag);
<price-tag cents="4999"></price-tag>

Framework-agnostic by design

Because they're a browser standard rather than a library feature, Web Components work inside a React app, a Vue app, or a plain static page without adaptation - genuinely useful for a shared component library used across several client stacks at once.

Where they still lag frameworks

State management and templating remain more verbose than React or Vue provide out of the box. We're reaching for them selectively - shared, cross-project widgets mostly - not as a full framework replacement.

Framework-agnostic by design

class UserCard extends HTMLElement {
  connectedCallback() {
    this.innerHTML = `<div class="card">${this.getAttribute('name')}</div>`;
  }
}
customElements.define('user-card', UserCard);

A registered custom element works identically whether it's dropped into a React app, a Vue app, or a plain HTML page - the browser itself understands it, with no framework adapter required. That portability is the whole pitch: a component built once as a Web Component doesn't need to be rebuilt for every framework a consuming team happens to use.

Shadow DOM is what makes style encapsulation real

Attaching a shadow root scopes a component's internal styles so they can't leak out and affect the rest of the page, and page styles can't accidentally reach in and break the component either - genuine style isolation, not the naming-convention approximation that BEM or CSS Modules provide. The tradeoff is a steeper API to learn and noticeably more boilerplate than the equivalent component in a framework like React or Vue.