Nascent Personality Manifestation

    TypeScript icon, indicating that this package has built-in type declarations

    8.1.13 • Public • Published


    build status coverage status npm version

    An extraordinary JavaScript framework for creating client-side web applications, UI components libraries, or single web components with unique mixed declarative and functional architecture

    Hybrids provides a complete set of tools for the web - everything without external dependencies:

    • Component Model based on plain objects and pure functions
    • Global State Management with external storages, offline caching, relations, and more
    • App-like Routing based on the graph structure of views
    • Localization with automatic translation of the templates content
    • Layout Engine making UI layouts development much faster
    • Hot Module Replacement support and other DX features


    The project documentation is available at the site.

    Quick Look

    Component Model

    It's based on plain objects and pure functions*, still using the Web Components API under the hood:

    import { html, define } from "hybrids";
    function increaseCount(host) {
      host.count += 1;
    export default define({
      tag: "simple-counter",
      count: 0,
      render: ({ count }) => html`
        <button onclick="${increaseCount}">
          Count: ${count}
    <simple-counter count="42"></simple-counter>

    Edit <simple-counter> web component built with hybrids library

    * Pure functions only apply to the component definition. Side effects attached to event listeners might mutate the host element.

    You can read more in the Component Model section.

    Global State Management

    A global state management uses declarative model definitions with support for async external storages, relations, offline caching, and many more:

    import { define, store, html } from "hybrids";
    const User = {
      id: true,
      firstName: "",
      lastName: "",
      [store.connect] : {
        get: id => fetch(`/users/${id}`).then(...),
      tag: "user-details",
      user: store(User),
      render: ({ user }) => html`
          ${store.pending(user) && `Loading...`}
          ${store.error(user) && `Something went wrong...`}
          ${store.ready(user) && html`
            <p>${user.firstName} ${user.lastName}</p>
    <user-details user="2"></user-details>

    You can read more in the Store section.

    App-like Routing

    Rather than just matching URLs with the corresponding components, the router depends on a tree-like structure of views, which have their own routing configuration. It makes the URLs optional, have out-the-box support for dialogs, protected views, and many more.

    import { define, html, router } from "hybrids";
    import Details from  "./details.js";
    const Home = define({
      [router.connect]: { stack: [Details, ...] },
      tag: "app-home",
      content: () => html`
        <template layout="column">
          <nav layout="row gap">
            <a href="${router.url(Details)}">Details</a>
    export define({
      tag: "app-router",
      stack: router(Home),
      content: ({ stack }) => html`
        <template layout="column">

    You can read more in the Router section.


    It supports automatic translation of the component's content, which makes translation seamless and easy to integrate. Additionally, it provides a way to add dynamic messages with plural forms, HTML content, or use messages outside of the template context. Also, it comes with handy CLI tool to extract messages from the source code!

    import { define, html, localize } from "hybrids";
    export default define({
      tag: "my-element",
      name: "",
      render: ({ name }) => html`
        <div>Hello ${name}!</div>
    localize("pl", {
      "Hello ${0}!": {
        message: "Witaj ${0}!",

    You can read more in the Localization section of the documentation.

    Layout Engine

    Create CSS layouts in-place in templates, even without using Shadow DOM, but still keeping the encapsulation of the component's styles:

      tag: "app-home-view",
      content: () => html`
        <template layout="column center gap:2">
          <div layout="grow grid:1|max">
          <footer layout@768px="hidden">...</footer>

    You can read more in the Layout Engine section of the documentation.


    Do you need help? Something went wrong? Feel free to create an issue in the github repository or join the Gitter channel.


    hybrids is released under the MIT License.


    npm i hybrids

    DownloadsWeekly Downloads






    Unpacked Size

    197 kB

    Total Files


    Last publish


    • smalluban
    • hybrids