π Introduction
Enhance server-rendered pages with lightweight, self-contained Web Components. No framework, no hydration issues, no unnecessary complexity.
What is UIElement?
UIElement is a lightweight JavaScript library that lets you build interactive Web Components without requiring a full JavaScript framework like React or Vue.
It works with your existing server-rendered HTML, enhancing it with stateful, reusable components that hydrate automatically β even when inserted dynamically.
- β Works with any backend β No need for a JavaScript-first stack like Next.js.
- β No build tools required β Just drop in components and they work.
- β Minimal JavaScript footprint β Less code over the wire, less complexity.
- β Future-proof β Web Components donβt break with framework updates.
Why Use UIElement?
If youβre looking for a simple, framework-free way to add interactivity to your web pages, UIElement is the perfect fit.
- Enhancing Server-Rendered Pages: Add client-side behavior to static HTML without worrying about hydration mismatches.
- Creating Standalone Web Components: Build self-contained UI elements that work anywhere β inside any CMS, e-commerce site, or dashboard.
- Adding Lightweight Interactivity: Skip the complexity of React or Vue for simple UI elements like tabs, counters, and interactive lists.
- Long-Term Stability: Web Components outlive JavaScript frameworks release cycles β your components wonβt break with each major update.
How UIElement Works
UIElement extends the native HTMLElement
class, letting you define custom Web Components that manage state with minimal code.
Unlike traditional frameworks that rely on a virtual DOM or dirty-checking, UIElement synchronizes automic pieces of state (signals) directly with the DOM, making fine-grained updates fast and efficient.
Example: Counter Component
Count:
Parity:
Source Code
Loading...
- β Zero re-renders β Only updates what changes.
- β No abstraction over the DOM β Works with plain HTML.
- β Fully self-contained β Can be used anywhere, even inside CMS templates.
How UIElement Compares
- No Virtual DOM: Unlike React or Vue, UIElement updates HTML directly, avoiding unnecessary renders.
- Minimal Overhead: Since it builds on Web Components, it has minimal impact on performance and bundle size.
- Simple API: Few, clear concepts (signals, effects, context) allow developers to quickly build interactive components.
Next Steps
Continue to the Installation & Setup to get started, or dive into Core Concepts to learn more about signals and reactivity.