This is a curated list of Web Components articles, design systems, libraries and resources.
Note
Write once, run anywhere (reusable HTML elements)
Note
Like any technology, they have their quirks and rough edges. But they are built into the browser and there are a lot of capabilities now, growing every year. — Rob Eisenberg
- 2024-10-09 —Reactive State with Signals in Lit
- 2024-10-01 — Web Components are not Framework Components — and That’s Okay
- 2024-09-29 — "Web Components" Are Not A Feature - It's an umbrella term
- 2024-09-28 — Web components are okay
- 2024-09-27 — Web Components Are Not the Future — They’re the Present
- 2024-09-27 — Web Components Are Not the Future — Web Components are a compromise through and through.
- 2024-08-20 — Server-first Web Components with DSD, HTMX, and Islands
- 2024-05-28 — Introducing WebUI 2.0 — Now rely on a repository of web components
- 2024-05-24 — Introducing the Fabric UX System
- 2024-04-16 — A (probably not) unbiased critique of Web Components, among other things — Keith Cirkel at Code '24
- 2024-02-01 — Using Global Styles in Shadow DOM
- 2024-01-31 — The Good, The Bad, The Web Components
- 2024-01-17 — Web Components 2024 Winter Update
- 2024-01-12 — A Modest Web Components Styling Proposal: An “I Know What I’m Doing” Selector
- 2023-11-27 — Web Components Eliminate JavaScript Framework Lock-in
- 2023-11-18 — An Attempted Taxonomy of Web Components HTML vs JavaScript Web Components
- 2023-11-17 — HTML Web Components are Just JavaScript? — Let the light DOM handle content wherever possible.
- 2023-11-15 — Step into the light (DOM)
- 2023-11-09 — HTML web components — On "Web augmentations"
- 2023-10-25 — Web Components Tailwind And SSR
- 2023-10-25 — Web Components Will Outlive Your JavaScript Framework
- 2023-10-01 — Photoshop is now on the web!
- 2023-09-21 — The design system ecosystem — "We now heartily recommend one specific technology to build a core design system for the web: Web Components."
- 2023-09-09 — W3C Web Sustainability Guidelines (WSG) 1.0 — "When custom components are needed, prefer Web Components over framework components"
- 2023-08-23 — Pros and cons of using Shadow DOM and style encapsulation
- 2023-08-23 — Use web components for what they’re good at
- 2023-08-18 — Shadow DOM: Not by Default
- 2023-08-13 — Enhance vs. Lit vs. WebC…or, How to Server-Render a Web Component
- 2023-08-12 — Shadow Themes
- 2023-08-07 — SEO and Web Components - 2023 Edition
- 2023-07-23 —
handleEvent()
is Mindblowing - Tip - 2023-07-20 — Hacker News Lit: Simple, fast web components
- 2023-07-19 — Dynamic Slots
- 2023-06-28 — If Web Components are so great, why am I not using them?
- 2023-05-10 — How To Hydrate A Server-Side Rendered Web Component
- 2023-04-17 — 2023 State of Web Components
- 2023-03-27 — Debunking Web Component Myths and Misconceptions ⭐ — by Rob Eisenberg from the FAST team
- 2023-03-09 — Faster dashboards with web components
- 2023-02-17 — Declarative Shadow DOM: One shadow per root ⭐
- 2023-02-13 — Hello Web Components
- 2022-10-21 — Let’s talk about web components
- 2022-02-17 — All the Ways to Make a Web Component
- 2021-05-26 — Links on Web Components
- 2021-05-15 — Container Queries in Web Components
- 2020-03-27 — The bright future of Web Components
- 2020-02-07 — Web Components Basics and Performance Benefits
- 2019-11-07 — The Firefox UI is now built with Web Components
- 2019-04-08 — A history of the HTML slot element
- 2018-09-06 — GitHub is using custom elements for their modal dialogs, autocomplete and display time.
- 2017-03-14 — Brief, incomplete, and mostly incorrect history of Web Components
- 2023-07-06 — The Good, The Bad, and The Web Components - Zach Leatherman | JSHeroes 2023
- 2023-06-20 — State of Web Components June 2023 - "Shoelace and DS are a very easy win in most cases"
- 2023-06-09 — Shining Light on the Shadow DOM | Cassondra Roberts | CSS Day 2023
import sheet from './base.css' assert { type: 'css' };
class MyButton extends HTMLElement
{
static observedAttributes = ['my-attr'];// tell the platform about reactive attributes
#internals;
#shadowRoot;
constructor() {
super();
// custom construction logic such as creating your shadow DOM
this.attachShadow({ mode: 'open'});
this.#shadowRoot.adoptedStyleSheets = [sheet];
// specify the default ARIA role
this.#internals = this.attachInternals();
this.#internals.ariaRole = 'button';
}
connectedCallback() {
// this lifecycle hook is called by the platform when your
// element is connected to the DOM
}
disconnectedCallback() {
// this lifecycle hook is called by the platform when your
// element is disconnected from the DOM
}
attributeChangedCallback(name, oldValue, newValue) {
// this lifecycle hook is called whenever one of your
// observed attributes changes in value
}
}
customElements.define('my-element', MyButton);
- Web Components are the native component model on the web platform.
- Web Components exposes capabilities previously reserved for native code
- Web Components are low level DOM APIs
From About Web Components by Rob Eisenberg
Web Components have clear performance benefits. There are several reasons for this:
-
The core capabilities of Web Components are implemented in C++/Rust as part of each browser’s native HTML parser and runtime. JavaScript frameworks simply can’t match the speed and memory efficiency of C++.
-
Because the component model is implemented by the browser, less JavaScript needs to be downloaded, parsed, and executed before a component is able to render.
-
With JavaScript frameworks, the browser doesn’t “see” the components and thus can’t optimize for them. It just looks like one gigantic DOM tree to the runtime. With Web Components, the browser knows about every component and its boundaries, and can perform various internal optimizations to improve performance. This is particularly important in applications with large amounts of CSS where the absence of Web Component Shadow DOM makes it impossible to fix certain rendering performance problems. Non-web component libraries literally block the browser from optimizations it could otherwise perform.
-
The Web Component model favors modern reactivity patterns and surgical DOM updates that massively outperform the Virtual DOM approaches of libraries like React. You can see this in the way that observedAttributes and the attributeChangedCallback work.
Web components are a collection of web standards (W3C Web Components Community Group) that enable an HTML native component model. They are a meta-specification made possible by the above specifications:
-
Shadow DOM
-
Custom Elements
-
HTML Templates
-
CSS changes
- Declarative Shadow DOM (DSD)
- DCE Demo Discussions
- DCE Proposal
- Server-Side Rendering (SSR) API
- #1009 Capabilities needed and open questions
- #939 Declarative Adopted Stylesheets
- Can I use
shadowrootmode
? - Chrome 90 (
shadowroot
— non-standard) - Chrome 111 (
shadowrootmode
— standardized) - Bugzilla #1712140
- Safari Technology Preview 162
A declarative API to allow the creation of #shadowroots using only HTML and no Javascript. This API allows Web Components that use Shadow DOM to also make use of Server-Side Rendering (SSR), to get rendered content onscreen quickly without requiring Javascript for shadow root attachment and population.
When the shadow root of an element has delegates focus flag set, focusing on the shadow host would automatically “delegates” focus to the first focusable element in the shadow tree instead.
-
- Custom Attributes (Identified)
- Enable the creation of reusable behaviors that can be attached to any HTML element (e.g.
<button material-ripple>Click Me</button>
).
- Enable the creation of reusable behaviors that can be attached to any HTML element (e.g.
- Custom Attributes (Identified)
-
Rendering & Performance
-
Template Instantiation
-
Package & Distribution
customElements.defineLazy('my-element', async () => (await import('my-element.js')).default);
Some tools/libraries that simplify Custom Elements
definition and content.
- Lit
- Relit Reusable lit controllers by James Garbutt
- Fast
- GitHub Catalyst
- SkateJS
- Stencil (23/08/2017) A web component compiler (powering Ionic 4)
- Atomico
- Hybrids
- Element-js
- µce (+µhtml+µce-template+µce-loader)
- GitHub Elements
- Material Design Web Components
- Chameleon UI
- Elix
- Helix UI
- Kickstand UI
- Kor UI
- LrnWebComponents
- Microsoft Fast
- Microsoft Graph
- PatternFly Design System
- Shoelace ❤︎
- SAP UI5
- Vaadin ❤︎
- Adobe Spectrum Design System〔Lit〕
- Astro Space Design System〔Lit〕
- Auro Design System by Alaska Airlines〔Lit〕
- AXA Pattern Library〔Lit〕
- Clever Cloud UI〔Lit〕
- Storybook〔Lit〕
- Repository
- Duet Design System by LocalTapiola〔Stencil〕
- Freshworks Crayons Design System〔Stencil〕
- General Electric Edison™ Design System
- IBM Carbon Design System〔Lit〕〔React〕
- ING Lion Design System + Lion Components〔Lit〕
- Microsoft Fluent UI〔Fast〕
- Fast
- React〔React〕
- Repository
- MixPanel Design System〔Panel〕
- Nord Design System〔Lit〕
- Porsche Design System〔Stencil〕〔Angular〕〔React〕〔Vue〕
- Red Hat Design System〔Lit〕
- Telekom Scale Design System〔Stencil〕
- VMware Clarity Design System
- Volkswagen GroupUI Design System
A couple of years back, Microsoft re-built the MSN experience with the Fluent UI Web Components based on FAST. This improved performance by 30%–50% over the previous React version Approximately 1,500 teams and/or projects within Microsoft have adopted FAST Web Components in the last three years (from 2022).
- Reddit (shreddit-mod-comment) Lit
- RedHat (
<pfe-navigation>
) - Bing
- British Gas
- Photoshop for Web
- Fast
- Ideanote
- Simplr
- ViteMaDose
- YouTube (
<ytd-video-preview>
) - App Store for Windows Source
The software giant has ditched its old React codebase from its previous web version of the Microsoft Store and replaced it with a modern web version that uses Shoelace, Lit, Vite, and a C# ASPNET backend.
- ChromeDevTools (
<devtools-button>
) - VSCode
- TikTok (
<cookie-settings-modal>
) - Figma
- SpaceX
- Shopify (
<ui-nav-menu>
) - Adobe Firefly
- Firefox
- Google Maps API (
<gmp-map>
)
- Brisa by aralroca
- Enhance (SSR First) by Brian Leroux + Enhance Movies Showcase (3.9 kb JS compressed) – Enhance provides file-based routing, reusable Custom Elements, a customizable utility CSS system, and mapped API data routes that get deployed to isolated, single-purpose cloud functions, no build steps to configure.
- Hybrids
- Rocket – A modern web setup for static sites with a sprinkle of JavaScript.
- Eleventy with WebC
- Appolo Elements
- CrossBow – The goal of Crossbow is to be the Next.js for web-components.
- Tini
- Gracile
- @thepassle/app-tools/router.js (URL Pattern Standard), used by App Store for Windows
- @vaadin/router
- @lit-labs/router
- @microsoft/fast-router
const counter = new Signal.State(0);
const isEven = new Signal.Computed(() => (counter.get() & 1) == 0);
- How Shadow DOM and accessibility are in conflict
- Accessibility in the Vaadin Platform
- 2023-07-09 — Web Components Accessibility FAQ
- 2023-02-22 — How Shadow DOM and accessibility are in conflict
- Cross-root ARIA Reflection API explainer
- 2012, W3C launched the first specification of Web Components
- 📈 Custom Element Popularity (
CustomElementRegistryDefine
stats) - 📈 Percentage of page loads that use custom element: over 19%
- Companies using Web Components
- Web Components Community
- Web Components and lists
- Awesome Lit
- Awesome Standalones
- Starter Templates
- Stubbornella on WC/Wasm
- FUD: Web components suck! No one is using them!