DEV Community

Cover image for The Past, Present, and Future of Web Components
Besworks
Besworks Subscriber

Posted on • Edited on

The Past, Present, and Future of Web Components

There is a lot of misinformation and misunderstanding surrounding Web Components. Many developers do not see their benefit or have misconceptions about what they can and cannot do. This series is intended to debunk those misrepresentations of this massively underappreciated set of tools.


The Past

To fully master this powerful feature of the web platform one must understand the history and reasoning behind their implementation.

From Chaos to Co-Operation

Web Components might seem like a recent trend, but their story goes back over the span of decades. Before React, Angular or even jQuery there was a much wilder time. Often referred to as the Wild West of the Web, I see this era more like the age of Feudalism with each browser vendor acting as their own virtual kingdom.

Through the 1990s and into the early 2000s, browsers were locked in a fierce competition. Netscape->Firebird->Firefox, Internet Explorer, Opera, and later Safari all vied for dominance, each pushing their own proprietary features and behaviors. Developers were left picking up the slack by writing clunky workarounds just to make websites behave consistently across platforms.

This era (known as the browser wars) fractured the web. Though the World Wide Web Consortium (aka the W3C) worked hard to standardize HTML and CSS, progress was slow and not all browser vendors followed their lead.

So engineers from Mozilla, Opera, and Apple broke away to form a new group in 2004: the Web Hypertext Application Technology Working Group, or WHATWG. Their goal was to evolve the web platform based on real-world usage and need. That effort led to HTML5 and planted the seeds for what we now call Web Components.

By this point in time, Facebook was a brand new university project and Google had just released GMail (available by invitation only) with no indication that they intended to break into the browser vendor scene. This happened 4 years later in 2008 when Chrome went public.

The Origins of Shadow DOM

One of the earliest glimpses of component-style architecture came from Mozilla. The UI for Netscape and later Firefox were built on a pair of proprietary technologies:

  • XUL (XML User Interface Language), and
  • XBL (XML Binding Language).

These tools let engineers define reusable widgets (buttons, panels, menus, etc) with custom behavior and internal styling. In other words, early components. But they weren’t standardized, and other browsers never adopted them.

Around the time Mozilla was working on XBL2, Google's engineers were developing Chrome Browser and ran into similar problems. They needed a way to structure element internals (like <video> player controls) without exposing them to developers or letting page styles bleed in. Their solution was Shadow DOM, a browser-native mechanism for true encapsulation. At first, this was used only for browser widgets. But the power it offered made it a prime candidate for something more ambitious.

From Internal Tooling to Developer Empowerment

Web Components as we know them now really began when these low-level browser features were proposed as developer-facing APIs. In 2011 Alex Russell made a historic presentation at Fronteers Conference. He demonstrated how Chrome Team was working to put the power of Shadow DOM into the hands of front-end web developers. Standardization efforts kicked off under the guidance of WHATWG and W3C collaboration and browser vendors worked together to agree on consistent, interoperable implementations.


The Present

Now that you know what led to the inception of Web Components. We must explore the evolution that brought them to their current state.

The Rise of Modern Frameworks

Today, Web Components are fully supported in all modern browsers. But this did not happen overnight. Meanwhile, the world kept on turning and businesses needed reliable ways to modularize their applications. Dozens of frameworks have been invented, adopted, and abandoned over the last decade or so. Each one sought to fill gaps in the coverage of the Web APIs.

While many frameworks developed a hardcore following, there was one standout player in this field: React. It's popularity is undeniable but this toolchain evolved independently from the core web platform, creating its own ecosystem and abstractions that have never aligned with the standards-based evolution of the web. This parallel development is reminiscent of the old browser wars. Except for one key difference: Meta is not a browser vendor.

Two Steps Forward, One Step Back

React contains many features that appear on the surface to provide the same functionality that Web Components offer but rely on non-standard extensions like JSX to accomplish this behavior. These features are added as a layer on top of the web platform and often their implementations have gone against the path laid out by the WHATWG.

The last time a proprietary technology competed against the spec we ended up with Flash. Many younger readers likely have never even heard of this but we old school pros remember rebuilding half the web to get rid of it. Today there is almost no evidence that Flash ever existed on the web, even though it only officially reached it's end-of-life a few years ago.

Perseverance Pays Off

The road that led Web Components to their current state was not a smooth one. Many proposals were made, tested, rejected and revamped to get to this point. The functionality that is now widely available across all modern browsers and devices took many years to get right.

For those of us who have been following this path since the beginning it is a time to rejoice because our dreams have finally come true. Shadow DOM and its associated APIs have opened up a whole new world of component design that is only just starting to show it's true potential.


The Future

Web Components have finally matured, but the real story they will tell is just beginning. With the core APIs now widely supported, we're entering a new phase of growth. One not just of adoption, but innovation.

Supporting the Standards

A wave of lightweight frameworks, libraries, and tooling is emerging that build on top of Web Components to enhance the developer experience. Two standout projects leading this charge are:

  • Lit by Google: A minimal library that works on concepts similar to React. Component libraries based on Lit, like Shoelace, are also taking off in popularity.

  • FAST by Microsoft: A thin abstraction layer used as the basis of Fluent UI, a set of themeable, accessible components aimed at enterprise-level UI development.

Unlike legacy frameworks that create their own abstractions, both Lit and FAST embrace the platform, extending Web Components in standards-friendly ways.

Big Names Making Big Changes

Major companies like Github, Reddit, Salesforce, Adobe, and many others have adopted or are transitioning toward Web Component based architectures.

The momentum is shifting. Not because of hype, but because of guaranteed longevity, interoperability, and performance. The exact same things React and friends originally promised, but now available without the use of third-party abstractions.

One Piece of The Puzzle

Web Components aren’t a silver bullet. Alone they don't provide everything that a framework does. They are just one part of a larger set of tools that is steadily moving toward richer, more powerful web applications. Web apps today have incredible features and flexibility that once belonged solely to the domain of native apps.

Here's a look at some of the emerging standards that will shape the next generation of web development:

Individually, each of these is a leap forward. Together, they signal a shift toward a post-framework era where the web platform is finally powerful enough to stand on its own, and modern apps can be built declaratively, securely, and efficiently with only minimal tooling. All of the newest features are enhancements. The groundwork has been laid, it's time to start building up.

The Platform Persists

Web Components are not a trend or the latest fad. They are the natural evolution of what made the web great in the first place: openness, modularity, and progressive enhancement. It's not just about what they do, but about how they blend seamlessly into the fabric of the web like they were always meant to be there.

With a foundation of tools like Web Components, ES Modules and a ton of mature as well as up-and-coming APIs, the future of the web looks bright indeed! In the past, we needed frameworks to fill the gaps. Today, those gaps are closing fast. And tomorrow, we might just look back on the framework era the way we now remember the days of Flash: As a wild adventure on the frontier that only those who were there could truly understand.

Top comments (27)

Collapse
 
jantimon profile image
Jan Nicklas • Edited

JSX is a standard - preact vue react typescript all follow the very same standard

Could you please explain why @click and refs is "embracing the standard"?

html`
      <button @click=${() => this.sort(1)}>Sort ascending</button>
      <input ${ref(this.inputRef)}>
    `
Enter fullscreen mode Exit fullscreen mode
Collapse
 
besworks profile image
Besworks

You are comparing a few decorators in a templating engine vs a complete markup language that transpiles into JS which then generates HTML.

JSX is NOT a web standard. Nor is TypeScript. Neither of these things work directly on the web without transpiling and likely never will.

BTW, personally I do not like syntactic sugar in any from.

Collapse
 
jantimon profile image
Jan Nicklas

JSX and Typescript are industry standards

Does that mean you are not only against frameworks but against transpiling in general?

Thread Thread
 
xwero profile image
david duymelinck

You mention industry standard so you are aware that it is a different kind of standard, otherwise you wouldn't add the specification.

The problem is that developers think they can't work outside the industry standards. I recently read a comment about how Tailwind made layers possible.
I have no problem with people using the DSLs and frameworks of their choice, but they should at least have an idea why it is preferable to using the technology it is build on.

Thread Thread
 
jantimon profile image
Jan Nicklas

industry standard means for me: chosen by millions
browser standard means for me: chosen by a handful

I don't think that's good or bad in any way because in the end it should never be WHO created the standard but only wether the standard itself is (still) good

One of my most preferred quotes is "Best practices deserve to be challenged" - so even if it is a industry standard today it might change tomorrow

I agree with your Tailwind example and hope people will take their time to learn also CSS not only an abstraction.

However who am I to judge how much knowledge a creator must have to build for the web?
In the end some might argue to understand how @layer works you should read its C++ implementations

I believe the most important thing is not the technology but the User Experience

Thread Thread
 
xwero profile image
david duymelinck

With user experience i think you mean developer experience? It is nice to have the most readable abstractions possible, but that should not be the most important thing in development.

You mention industry standards can change, the thing with web standards is that they are not meant by be changed. The standards operate on different levels. We all need safe drinking water, web standard, countries decide to add additives, industry standard.

Industry standards are also more a strategic decision by companies than a developers choice. If you have a lot of people making certain software it is easier to hire people, a lot of problems are already solved and can be plugged in using packages.
The best example is Wordpress. It is the CMS industry standard, but no developer is willingly learning how to use Wordpress. As a PHP developer I'm ashamed this is an industry standard.

Thread Thread
 
jantimon profile image
Jan Nicklas

With user experience I mean end user experience - that is an will always be my priority.

Second most for me is maintainability (here the developer experience comes in) - it helps to adjust to new end user needs, fix bugs, and so on

And I 100% agree with you - industry standards are built on top of web standards.
That's why I don't like people trying to force people to choose A over B - it just doesn't really matters wether you use Lit or React as long as End Users are happy and you can maintain your codebase

I wish more people would focus on solving real world user problems instead of fighting about technologies

Thread Thread
 
xwero profile image
david duymelinck

Do you really prioritize end user experience when you want them to load a bunch of javascript to generate HTML? That is what every frontend framework does.
So it does matter for your end users to prefer web standards over third party code.

I don't call this a fight, i call it a debate. You can leave it with your mind changed or not.
I agree that there are technology debates that are stupid. I don't think the information in the post is one of them.

Thread Thread
 
jantimon profile image
Jan Nicklas • Edited

For me performance is a User Experience.

  • How fast did they see the page?
  • Did it respond when they wanted to perform an interaction

In the age of tiktok netflix and youtube the meaning of javascript kilobytes isn't as relevant anymore as it used to. Maybe if your users live in developing countries but even there things changed a lot to the better.

But let's say my user would really care for how many javascript bytes they download.

Can you help me out and tell me how much larger is a preact app vs a lit app?

Thread Thread
 
xwero profile image
david duymelinck

It is not about the size, but as you mention how fast the page is visible.
HTML is the fastest way, that is the reason all the view frameworks provide server side rendering. Which is the thing they wanted to avoid initially, in the name of the single page app hype.

Most sites are not video sites, so the size of the javascript can become a significant part of the load time.

Thread Thread
 
jantimon profile image
Jan Nicklas

So you agree that with Server Side Rendering the javascript size is way less important?

Did you know that minifiers minify web-components less efficient because they use classes?

I did a quick experiment I ran npm init @open-wc, deleted all boilerplate code and copied the official lit example from lit.dev/playground/#sample=example... in that project

After that I ran npm init preact deleted all boilerplate code and used a LLM to port the example to jsx. I did no further optimizations.

Both examples work just fine with the same behaviour - here are the sizes:

web-component: 18kb
preact: 14kb

Does that mean everyone must stop using web-components to ship less javascript?

Thread Thread
 
xwero profile image
david duymelinck

So you agree that with Server Side Rendering the javascript size is way less important?

No, because you are sending the html and the javascript to create the page. You can't remove the html generation and only keep the page interactions as far as I know.

Did you know that minifiers minify web-components less efficient because they use classes?

A class has more moving parts than a function, so it is logical a minifier can't change as many names as with functions. A minifier is an additional tweak to reduce the size, so it matters less in this conversation.

Does that mean everyone must stop using web-components to ship less javascript?

I mentioned the size of javascript because of your remark about video sites. The gains there are going to be much higher by optimizing video instead of javascript. But of course they should do both.
If you have a blog that is mainly text and you load a javascript view engine that is going to take a bigger piece of the load time relative to HTML and CSS.

With the Lit example everything is still in javascript. With web components you can use HTML templates for the CSS and HTML. Which means only the mounting of the template and the interaction with it is in javascript.
You could even have the template content as separate files in the backend and embed them in the html when the page is generated. This skips the mounting which means less javascript code.
This shows that you have more options with web components than with a javascript only render engine to control the rendering of a page.

Thread Thread
 
besworks profile image
Besworks • Edited

Industry Standards: Adopted by convention.
Web Standards: Implemented by consensus.

The web standards are painstakingly debated and refined until all browser vendors agree. The reason they take so long to implement is because they affect EVERYONE who uses the web, indefinitely.

with Server Side Rendering the javascript size is way less important

4kb isn't exactly a performance killing amount of JS. The lowest average mobile data speed in the world is ~13mbps and the countries with weak broadband connections are not ones that the average web dev is generally targeting. The ones who are must take on the responsibility of managing those limitations. Static HTML/CSS with no JS at all would be far more appropriate for them and aligns with these core tenets of the web: Progressive Enhancement and Graceful Degradation. Well designed Custom Elements fit perfectly with either of these approaches.

With web components you can use HTML templates for the CSS and HTML. Which means only the mounting of the template and the interaction with it is in javascript.

This guy gets it.

Whether a component is written in React or as a Custom Element, all complex interaction must be done with JS. React doesn't magically avoid that. In fact, it often adds to the problem because not only do you need to load your component, but also a runtime to use it.

Did you know that minifiers minify web-components less efficient because they use classes?

The only part of a class that cannot be minified is the public API. This is true about ANY library. If I write a component that has an interface like MyComponent.doSomething() and it gets minified to M.d(), that's going to break any external usage of it. It is totally possible to minify other parts of a class.

Besides, most web servers and all major browsers support HTTP compression. The size savings from gzipping alone is only slightly less than minification alone. Depending on your code, minification may only save ~10% extra bandwidth on top of compression. Hardly worth it, especially if you write tidy, modular code to begin with.

For me performance is a User Experience.

Did you know that monolithic bundles are less efficient than using individual ES Modules effectively? By inlining above-the-fold assets, asynchronously preloading additional assets, and caching everything with a service worker, you can create a user experience that is at least as smooth as a fully server-side rendered app, if not more so. And when you need to update a component, no build steps are required. The browser only needs to download the one module that changed instead of an entire bundle allowing the remainder of the modules to stay cached. In the end, with this approach, both the developer and user benefit.

Thread Thread
 
jantimon profile image
Jan Nicklas

No, because you are sending the html and the javascript to create the page. You can't remove the html generation and only keep the page interactions as far as I know.

That's exactly the idea of hydration - ship static html which can be rendered before any javascript is transferred. The browser starts downloading images, applies css and renders everything. In the background it also downloads javascript for interactivity in a non blocking way. Modern Frameworks even support selective hydrations which add interactivity based on interactions.

That means for example if you click a search bar it will first hydrate the search bar to ensure that if you had any interaction for a click that it will be prioritized.

There is even the concept of React Server Components which optimizes even further and allows you to decided for every component wether it should be part of the browser javascript bundle or stay only on the server.

A minifier is an additional tweak to reduce the size, so it matters less in this conversation.

You said before that it's important to you to send less javascript. If one technology is harder to optimize for less javascript - Why wouldn't that count for that argument?

a blog that is mainly text

I agree - for pages which don't require much interactions most frameworks are probably the wrong choice. Just being curious is that a realistic problem today - can you show me any personal personal blog with a lot of traffic which is too slow because of a big framework it uses?

With the Lit example everything is still in javascript. With web components you can use HTML templates for the CSS and HTML

That's correct - but that's also a different use case.

If that is your use case web-components make a lot of sense and can be the perfect fit. (As I said for the static blog)

Don't fall for the law of the hammer - only because it might be great for a personal blog it doesn't mean it is the best choice for everything

Here is an example (probably not the best one - maybe you can show me better ones):

web-components
2mb unused javascript
pagespeed.web.dev/analysis/https-w...
core web vitals for youtube

react
600kb unused javascript
pagespeed.web.dev/analysis/https-v...
core web vimeo for youtube

There might be counter examples (hopefully) but what I want to show heres is: picking web-components doesn't mean perfect performance. Unfortunately it is not that easy.

Thread Thread
 
xwero profile image
david duymelinck • Edited

In the background it also downloads javascript for interactivity in a non blocking way.

Sure hydration defers the javascript, but it is not possible to separate the HTML generation from the interaction. So when the HTML is already created, the HTML generation part in javascript is useless. As far a i know you can't have a button component that doesn't have both, am I wrong?

This is where web components have the advantage and that is why I mentioned templates.

for pages which don't require much interactions most frameworks are probably the wrong choice. Just being curious is that a realistic problem today - can you show me any personal personal blog with a lot of traffic which is too slow because of a big framework it uses?

This feels you are contradicting yourself. A framework is a bad fit for a blog, but as long as you put in the effort to make it fast enough it is ok?

but that's also a different use case.

How is moving HTML and CSS to templates another use case?
Web components allow you to place markup in markup files. It seems like a no-brainer to me. You can't do that with view engines because markup is most likely javascript in disguise, that is what JSX is.

Don't fall for the law of the hammer

I never mentioned web components are the silver bullet solution, you need to tweak them like any other technology.

I'm not sure why the pagespeed examples are the way they are, because i don't want to spit through the code, but web components are not inherently going to have more unused code or be slower than other solutions.

Thread Thread
 
besworks profile image
Besworks

Just gonna drop this super relevant comment here:

If you're using web components (or just custom elements without web components) and want to do server-side rendering, definitely check out Enhance: enhance.dev/. That way you can have all the benefits of custom elements and web components, and still have the SEO and performance benefits of SSR. For simpler pages, you might not even need any client-side JS at all and can still use custom elements and slots to render your HTML.

Thread Thread
 
jantimon profile image
Jan Nicklas

Looks really nice - basically a SSR engine to render web-components with Node.js - correct?

Thread Thread
 
besworks profile image
Besworks • Edited

Kinda, but there's more to it. Enhance is based on Arc which is a serverless framework. It supports multiple runtime environments by compiling your app into WASM.

Node is just the default runtime and doesn't require an extra compilation step. It's not often that I am impressed by a framework but this one has definitely grabbed my attention!

Thread Thread
 
jantimon profile image
Jan Nicklas

So when the HTML is already created, the HTML generation part in javascript is useless.

Yes and no - it's similar to templates in web-components. Modern frameworks are built for highly interactive pages and flexible code organisation. The idea is that any state change can update the entire page or reuse a component template multiple times. Therefore the template needs to be part of the javascript. Same as web-component templates inside the html.

However as I said before you can use RSC to only send interactive parts or render it statically.

This feels you are contradicting yourself. A framework is a bad fit for a blog, but as long as you put in the effort to make it fast enough it is ok?

Correct - if someone enjoys trying out any technology on a personal blog and the load time is good enough - why not.. its their personal blog anyway.

It's probably really hard to build a slow personal blog.

However for a page with almost no javascript web-components are probably the less complex way.

My questions was rather - if it's really that important to you - are you trying to solve a real world problem or just a theoretical one? Can you show me some slow blogs which are slow because they don't use web-components?

Thread Thread
 
xwero profile image
david duymelinck

However as I said before you can use RSC to only send interactive parts

From the example in the documentation I see it still requires HTML generation.

Server components are no solution for the ability to add a javascript to any HTML tag.
You don't need to use a web component if the only thing needed is interactivity.

if someone enjoys trying out any technology on a personal blog

The blog example was a reaction on your comment about the video sites, were you mentioned that the size of javascript matters less.
I could used a shop or a forum or any site with more interaction. A blog is too extreme in the other direction, that was my mistake.

With the effort remark i reacted to the scaling, because you mentioned a highly frequented website. It is easier to scale a website based on web components than a website which is generated by a view engine.
Web components should only be used if there is a returning pattern. Otherwise you can use CSS and javascript on any HTML element by using a class.

are you trying to solve a real world problem or just a theoretical one?

I solve real world problems with the right tools. If it is a blog, I just send HTML. If it is a shop I use web components. If it is a highly interactive dashboard I use a javascript render engine.

 
jantimon profile image
Jan Nicklas

What would be the use case for WASM?

Thread Thread
 
besworks profile image
Besworks

It's not that you would use WASM directly, what it does is allow you write your back-end in any supported language: Go, Rust, Ruby, etc. Your code then gets compiled to WASM for deployment.

Collapse
 
aloisseckar profile image
Alois SečkÑr

JSX is a standard, because React made this proprietary technology a "standard". It is pretty fair to say it was non-standard back in the days when React rose to power.

And btw Vue only incorporates JSX support to please React devs who cannot let go. Without React background (like me) there are exactly zero reasons (and also no necessity) to use it for templating.

Collapse
 
dannyengelman profile image
Danny Engelman

One of the earliest glimpses of component-style architecture came from Mozilla.

That was 2001

Microsoft HTML Components (HTC) was 1998

John Udells BYTE article on Web Components was 1996

Collapse
 
besworks profile image
Besworks

Let's not reignite the browser wars 😏 but...

XUL was created in 1997 for Netscape. XBL came later in 2001.

That article may predate this but it doesn't really relate. It's mostly about cgi scripting, though it does mention ActiveX and Java which (while technically are examples of components) weren't exactly the same idea. The difference being that XUL was an extension of HTML with a library of widgets rather than a mechanism for loading compiled application code. Hence the name they were eventually given: applets.

Microsoft's HTML Components are definitely relevant to the history but I chose not to include them in the article as it was already quite long, Internet Explorer no longer exists, and XBL had the most direct influence on Shadow DOM. However, many concepts from their original proposal are clearly evident in the modern Web Component standard.

Collapse
 
dannyengelman profile image
Danny Engelman

Whilst we are not forgettting history

Everyone should know about the Mundaneum

independent.co.uk/travel/europe/mu...

Collapse
 
nevodavid profile image
Nevo David

Pretty cool seeing the web finally getting stable tools I actually want to use - feels like it’s been a long grind for this kind of stuff.