Why web components finally grew up
For years, web components were the technology that was perpetually about to be useful. That has changed quietly. Custom elements, shadow DOM and HTML templates have been stable in every major browser for a long time, and the pieces that used to be missing are now settled too: declarative shadow DOM, which lets components render on the server and completed cross-browser support in 2024, and form-associated custom elements, which let a custom tag behave like a real form field. In 2026 the platform itself gives you everything needed to build reusable UI without installing a framework.
This matters more to small businesses than to big tech firms. If you have ever rebuilt the same enquiry form, review carousel or price calculator because your site moved from WordPress to Shopify to a custom build, you have paid the framework lock-in tax. That tax shows up as agency invoices, delayed launches and inconsistent branding. A web component is written once, in standard JavaScript, and works in all of those places unchanged.
What a web component actually is
A web component is a custom HTML tag that you define yourself. You write a JavaScript class, register it with customElements.define('booking-widget', BookingWidget), and from that point the browser treats <booking-widget> like any other element. Three platform features do the heavy lifting:
- Custom elements: lifecycle callbacks that run when your tag is added to the page, removed, or has an attribute changed.
- Shadow DOM: a private area for the component's markup and styles, so its CSS cannot leak out and the page's CSS cannot break it.
- Templates and slots: reusable markup with named gaps, so whoever uses the component can pass in their own content.
The newer form-associated capability deserves a special mention for business sites. Using ElementInternals, a custom element can participate in a normal HTML form: it can carry a value, be validated, and submit alongside ordinary inputs. That makes custom date pickers, postcode lookups and consent controls behave properly instead of fighting the platform.
Because the contract is HTML itself, there is no compiler and no runtime to ship. A finished component can be a single JavaScript file loaded with one script tag, cached by the browser like any other asset.
Need a hand with this?
Our team delivers Web Design for UK businesses — with a free initial consultation, transparent fixed quotes and no lock-in contracts. Tell us what you're working on →
A worked example: one booking widget, every stack
Imagine a salon group that takes bookings on three websites: a WordPress brochure site, a Shopify store and a React-based members' area. Instead of maintaining three booking forms, you build one custom element. The markup on any of those sites is identical: <booking-widget service="haircut" location="west-bromwich"></booking-widget>, plus one script tag pointing at the component file.
Inside the class, the component reads its attributes, fetches available slots from your booking API, and renders a date and time picker inside its shadow DOM. When a customer confirms, it dispatches a custom booking-confirmed event carrying the booking reference, which each host site can listen for and handle however it likes: WordPress might show a thank-you banner, while the React app updates its own state.
Styling stays flexible without breaking encapsulation. Expose colours and fonts as CSS custom properties (--booking-accent, for instance) and mark key internals with the part attribute, so host pages can restyle them using the ::part() selector. The widget inherits each site's branding while its layout and logic stay protected.
Where web components beat framework components
Framework components are excellent inside their own ecosystem. Web components win when the ecosystem itself is the problem:
- You need one UI in several places. A design system or shared widget used across WordPress, Shopify and a custom app only has to be built and tested once.
- You are shipping an embed. Review badges, calculators and booking widgets dropped into other people's sites cannot assume any framework is present.
- You want longevity. Frameworks release breaking major versions; browser standards almost never do. A component written today should still run in 2036.
- You have mixed teams. Agencies and in-house developers can share components without agreeing on a stack first.
There is a performance angle too. A small widget built on platform features ships a few kilobytes of JavaScript, while embedding a framework component usually means shipping the framework alongside it. On mobile connections, that difference is visible in load times and in Core Web Vitals.
When a framework is still the right call
Genuinely app-like products still favour frameworks: dashboards with complex shared state, collaborative editors, or anything where dozens of components coordinate constantly. React, Vue and Svelte also bring mature routing, data-fetching and testing ecosystems that raw custom elements do not. If your roadmap points towards a full application rather than a website with interactive islands, choosing an established framework remains sensible, not least because it is easier to hire for.
The middle ground: Lit
If writing raw custom elements feels verbose, Lit is a small library from Google that adds declarative templates and reactive properties while still producing standard web components. You get framework-like ergonomics, and the result still runs anywhere HTML runs, with no lock-in for whoever consumes it.
Key Takeaway
Web components are now a practical default for any UI you expect to reuse across platforms. Build the element once with custom elements and shadow DOM, expose settings as attributes and results as events, and the same script tag works in WordPress, Shopify, React or plain HTML. Reach for a framework when you are building a genuinely app-like interface; reach for web components when you are building blocks you want to keep for a decade.
Adopting web components without a rewrite
You do not need a migration project to benefit. The realistic path looks like this:
- 1. Pick one repeated UI element, ideally something already duplicated across sites, such as an enquiry form or opening-hours panel.
- 2. Build it as a custom element with shadow DOM, exposing options as attributes and outcomes as events.
- 3. Host the script on your own domain with long cache headers and a versioned filename.
- 4. Swap it into one site, test it thoroughly, then roll it out to the rest.
- 5. Keep a simple changelog; consumers only ever update one script tag.
Start small and the payoff compounds: every new platform your business adopts inherits your existing components for free, and every redesign stops being a rebuild of everything at once. If you would like help designing or building a component library that outlives your current website, our team at Thind Global Services does exactly this kind of work.
