Home Workflow Pulse Platform Join us!
Symbiote.js

Symbiote.js

A friendly DX-focused extension for native Custom Elements.

Documentation Code Playground npm GitHub Community

So, what's the big idea?

Symbiote.js isn't trying to be yet another frontend library. Think of it more like a philosophy for web development that embraces the power of what's already built into your browser.

We believe in using modern, standard web technologies, not reinventing them. Symbiote.js simply adds a touch of modern developer experience (DX) on top of vanilla Custom Elements. You get cool things like reactive data bindings, flexible HTML-based templates, powerful state management, and easily extendible components, all with minimal boilerplate and setup.

Here’s what makes it feel a bit different:

It’s a Pure DOM Extension

Unlike frameworks that wrap your code in complex abstractions, Symbiote.js works directly with the native DOM API. For you, this means:

Simple HTML String Templates

We take a refreshingly simple approach to templating:

// Define templates anywhere, client or server:
import html from '@symbiotejs/symbiote/core/html.js';

const myTemplate = html`
  <div class="my-component" ${{onclick: 'showBubble'}}>
    <h1>{{title}}</h1>
    <div>{{content}}</div>
  </div>
`;

DOM-Based Data Context

This is where things get interesting. Symbiote.js has a fresh take on how components talk to each other and manage state:

// Inherited context (^)
html`<button ${{onclick: '^onButtonClicked'}}>Click me!</button>`;

// Shared context (*)
html`<div>{{*sharedProperty}}</div>`;

// Named context (/)
html`<div>{{APP/someProperty}}</div>`;

Where It Really Shines

The Core Goodness

Give It a Spin

<script type="importmap">
  {
    "imports": {
      "@symbiotejs/symbiote": "https://esm.run/@symbiotejs/symbiote"
    }
  }
</script>

<script type="module">
  import Symbiote, { html, css } from '@symbiotejs/symbiote';

  export class MyComponent extends Symbiote {

    // Initialize state:
    init$ = {
      count: 0,
      increment: () => {
        this.$.count++;
      },
    }

  }

  // Define template:
  MyComponent.template = html`
    <h2>{{count}}</h2>
    <button ${{onclick: 'increment'}}>Click me!</button>
  `;

  // Add styles:
  MyComponent.rootStyles = css`
    my-component {
      color: #f00;
    }
  `;

  // Register the custom element:
  MyComponent.reg('my-component');
</script>

<my-component></my-component>

This little HTML example has everything you need to get a Symbiote.js app running. While it shows off the basic concepts, you can totally use it with your favorite development tools like TypeScript, bundlers, linters, and all that good stuff.

Want to Learn More?

npm Documentation Live Code Playground GitHub Community Discussions
28.09.2024
It was really possible?
Symbiote.js as an answer to many questions
17.09.2024
Smart HTML-tags
Simple recipe with the Artificial Intelligence
25.01.2024
Symbiote VS Lit
David and Goliath: differences, pros and cons...
18.01.2024
Symbiote.js 2.x
The new major version is released. Let's see what's new...
RND-PRO.com © 2025