Skip to content
Tech News
← Back to articles

Elena, a library for building Progressive Web Components

read original more articles
Why This Matters

Elena is a lightweight library designed to simplify the creation of Progressive Web Components by emphasizing HTML and CSS first, with JavaScript added progressively. Its approach addresses common industry challenges such as accessibility, server-side rendering, and layout stability, making it a valuable tool for developers aiming for efficient, compatible, and accessible web components. This innovation enhances both developer productivity and user experience in the evolving landscape of web development.

Key Takeaways

Are you an LLM? View /llms.txt for optimized Markdown documentation, or /llms-full.txt for full documentation bundle

██████████ ████ ░░███░░░░░█░░███ ░███ █ ░ ░███ ██████ ████████ ██████ ░██████ ░███ ███░░███░░███░░███ ░░░░░███ ░███░░█ ░███ ░███████ ░███ ░███ ███████ ░███ ░ █ ░███ ░███░░░ ░███ ░███ ███░░███ ██████████ █████░░██████ ████ █████░░████████ ░░░░░░░░░░ ░░░░░ ░░░░░░ ░░░░ ░░░░░ ░░░░░░░░ ░█ Simple, tiny library for building Progressive Web Components.|

Introduction

What is Elena? ​

Elena is a simple, tiny library for building Progressive Web Components. Unlike most web component libraries, Elena doesn’t force JavaScript for everything. You can load HTML and CSS first, then use JavaScript to progressively add interactivity.

Here is a minimal example ​

HTML Styles JavaScript html < elena-stack direction = "row" > < div >First</ div > < div >Second</ div > < div >Third</ div > </ elena-stack > css @scope (elena-stack) { :scope { display : flex ; justify-content : flex-start ; align-items : flex-start ; flex-flow : column wrap ; flex-direction : column ; gap : 0.5 rem ; } :scope [ direction = "row" ] { flex-direction : row ; } } js import { Elena } from "@elenajs/core" ; export default class Stack extends Elena (HTMLElement) { static tagName = "elena-stack" ; static props = [ "direction" ]; direction = "column" ; } Stack. define ();

Try it in the playground

Prerequisites This documentation assumes familiarity with HTML, CSS, and JavaScript. If you're new to custom elements, the MDN guide is a good starting point, though prior experience is not required.

Why was Elena created ​

... continue reading