Insights / From practice

element-js and the role of native Web Components.

In the existing Lab, dev5310 introduced element-js, a library developed together with loewen.digital. The approach uses native Web Components and a lean component model. An architectural decision depends on more than the library: content modelling, integration, accessibility and the operating team's capabilities also matter.

All articles

The web platform as the foundation

Custom Elements enable custom HTML elements with defined behaviour. This is useful when reusable interactions need embedding in different pages or existing applications. The web platform supplies basic mechanisms; the business component architecture still needs designing.

We clarify which data a component receives, which states it represents and how it reports changes externally. Loading, errors and missing data also need defined behaviour. A stable component interface is often more important for reuse than the shortest possible implementation example.

Use encapsulation deliberately

Shadow DOM can separate a component's internal presentation from the surrounding page. This helps limit unintended CSS interactions. At the same time, it must be clear how the application passes design requirements and variants to the component.

Encapsulation also changes the integration task. Focus, labels and use with assistive technology are tested in the actual context. Choosing Shadow DOM establishes neither accessibility nor security. It remains necessary to consider the complete interaction from the user's perspective.

Dependencies are one decision criterion

A lean dependency set can make maintenance easier, but is not a complete quality measure. Source code, tests, documentation and the ability to address faults within your own team matter as well. A rarely changed package and an actively maintained package each raise different evaluation questions.

Before adoption, we examine the specific state, licence and required features. Open source enables inspection and development, but does not replace technical review. The cost of later replacement and building knowledge within the team also belong in the decision.

Choose React, Vue or Web Components for the task

A substantial interactive application needs different structures from individual building blocks on server-rendered pages. React, Vue and Web Components are therefore assessed against data flows, routing, integration and team knowledge. An isolated bundle-size comparison does not fully reflect these requirements.

We also consider rendering, debugging, testing and CMS integration. A small prototype should demonstrate a representative workflow, rather than only a simple button. This shows which parts the chosen technology simplifies and which additional conventions the team needs.

What continues to matter in a CMS project

A CMS project needs an understandable relationship between content and component. Editors need suitable fields, clear variants and a useful preview. The frontend must also handle long texts, missing images and references that have not yet been published.

These requirements exist independently of the component library. Performance and accessibility are tested on the integrated solution. Blanket promises such as “maximum security” or “always better INP values” do not follow from a technology choice. A tested use case and clear rules for further development make the decision sound.

Sources and background

Which component architecture suits your project?

We consider interaction, the content model and integration together with your team. A representative prototype can inform the decision between existing and new technical approaches.

Arrange a conversation

Discuss frontend architecture