An open API service indexing awesome lists of open source software.

https://github.com/ctnicholas/modjool

Tiny, elegant, enjoyable; custom elements with Modjool. Ideal for creating user interface libraries & reusable web components.
https://github.com/ctnicholas/modjool

Last synced: 5 months ago
JSON representation

Tiny, elegant, enjoyable; custom elements with Modjool. Ideal for creating user interface libraries & reusable web components.

Awesome Lists containing this project

README

          



modjool - custom elements  & web components



npm npm bundle size JavaScript Style Guide NPM

# [Documentation](https://modjool.js.org)
Full guide & documentation available at the [Modjool Docs](https://modjool.js.org) website.

## Latest update
**v1.1** - Added [findSlot instance param](https://modjool.js.org/docs/slots#slot-elements), enabling easy creation of [headless components](https://modjool.js.org/docs/headless-components).

# Introduction
Modjool is a lightweight JavaScript framework for creating user interface libraries
and simple web components. It's ideal for creating UI libraries and simple reusable components, by
allowing for easy creation of native custom elements.


## Overview of features

* **Simplicity** - simplify away classes, styling, multiple HTML tags, into one custom element
* **HTML templates** - use attributes, slots, dynamic content & more
* **CSS templates** - with scoped CSS, and all the above
* **Lifecycle events** - run JS at different points in an element's lifecycle
* **Reactive data** - body updates when the data changes
* **Pairs up** - combine with CSS libraries, such as Tailwind, Bulma, Bootstrap


## Code example
```javascript
modjool.create({
tag: 'like-button',

js: ({ attr, elem }) => {
elem.onclick = () => attr.likes++
},

html: ({ attr, slot }) => `

${slot} • ${attr.likes}

`
})
```

```html
Like me!
```

Try `` on CodeSandbox:

[![Edit Modjool ](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/modjool-like-button-6gfyo?fontsize=14&hidenavigation=1&theme=dark&file=/like-button.js)

## Read more
[Guide](https://modjool.js.org/docs) and [API](https://modjool.js.org/api) available at the [Modjool Docs](https://modjool.js.org) website.