Web components, explained without the jargon
The version of this that works is simpler than the version most people imagine. Here is web components without the vocabulary that usually surrounds it.
Code gets read far more often than it gets written, and usually by someone with less context than the author had. Doing this properly once is usually cheaper than doing it approximately three times.
The short version
Custom elements work without committing to a framework. The teams that handle this well are rarely the ones with the biggest budgets. Budget a little time for it every quarter and it never becomes a project of its own.
Why people complicate it
Most of the confusion comes from tooling rather than from the idea itself. The reasoning matters more than the rule, because the rule has exceptions.
Encapsulation stops styles leaking between features. That sounds obvious written down. It is still the thing most often skipped. If it only works because one person remembers to do something, it does not work yet.
Turning this into a decision
Useful when several teams share one component set. The reasoning matters more than the rule, because the rule has exceptions. The failure mode is not doing it wrong, it is doing it once and assuming it stays done.
How to tell if yours is fine
Most development decisions are really maintenance decisions wearing a different hat. Three things worth confirming about web components before you move on:
- Someone can say what the current setup is without going to look
- Useful when several teams share one component set — and you know whether that is true here
- There is a way to tell whether the last change to this helped
Worth checking on your own setup before it becomes someone else's problem to fix.