hybrids
Version:
The simplest way to create web components with plain objects and pure functions!
65 lines (50 loc) β’ 3.4 kB
Markdown
<h1 align="center">
<img alt="hybrids - the web components" src="https://raw.githubusercontent.com/hybridsjs/hybrids/master/docs/assets/hybrids-full-logo.svg?sanitize=true" width="500" align="center">
<br/>
</h1>
[](https://www.npmjs.com/package/hybrids)
[](https://bundlephobia.com/result?p=hybrids)
[](https://github.com/hybridsjs/hybrids/blob/master/types/index.d.ts)
[](https://travis-ci.com/hybridsjs/hybrids)
[](https://coveralls.io/github/hybridsjs/hybrids?branch=master)
[](https://www.npmjs.com/package/hybrids)
[](https://gitter.im/hybridsjs/hybrids)
[](https://twitter.com/hybridsjs)
[](https://conventionalcommits.org)
[](https://github.com/prettier/prettier)
[](LICENSE)
> π
One of the four nominated projects to the **"Breakthrough of the year"** category of [Open Source Award](https://osawards.com/javascript/) in 2019
**hybrids** is a UI library for creating [web components](https://www.webcomponents.org/) with unique declarative and functional approach based on plain objects and pure functions.
* **The simplest definition** β just plain objects and pure functions - no `class` and `this` syntax
* **No global lifecycle** β independent properties with own simplified lifecycle methods
* **Composition over inheritance** β easy re-use, merge or split property descriptors
* **Super fast recalculation** β smart cache and change detection mechanisms
* **Global state management** - model definitions with support for external storages
* **Templates without external tooling** β template engine based on tagged template literals
* **Developer tools included** β HMR support out of the box for a fast and pleasant development
## Quick Look
```html
<script type="module">
import { html, define } from 'https://unpkg.com/hybrids@^6';
function increaseCount(host) {
host.count += 1;
}
define({
tag: "simple-counter",
count: 0,
render: ({ count }) => html`
<button onclick="${increaseCount}">
Count: ${count}
</button>
`,
});
</script>
<simple-counter count="10"></simple-counter>
```
> Click and play with `<simple-counter>` example:
>
> [](https://codesandbox.io/s/simple-counter-web-component-built-with-hybrids-library-co2ow?file=/src/SimpleCounter.js)
## Documentation
The project documentation is available at the [hybrids.js.org](https://hybrids.js.org) site.
## License
`hybrids` is released under the [MIT License](LICENSE).