UNPKG

1.94 kBMarkdownView Raw
1# mosaic
2
3## [![npm](https://img.shields.io/npm/v/mosaic.svg)](http://npm.im/mosaic) [![Build Status](https://travis-ci.com/defx/mosaic.svg?branch=master)](https://travis-ci.com/defx/mosaic) [![Coverage Status](https://coveralls.io/repos/github/defx/mosaic/badge.svg?branch=master)](https://coveralls.io/github/defx/mosaic?branch=master) [![gzip size](https://img.badgesize.io/https://unpkg.com/mosaic/dist/mosaic.min.js?compression=gzip&label=gzip)]()
4
5Mosaic is a framework for building user interfaces for the web
6
7## Features
8
9- Simple templates for declarative data & event binding
10- Reactive data bindings update your view efficiently and
11 automatically
12- Full component workflow using standard Custom Elements
13- Small footprint (~4k)
14- No special compiler, plugins, required
15- Minimal learning curve (almost entirely standard HTML, JS,
16 and CSS!)
17- Interoperable with other libraries and frameworks
18
19[Learn how to use Mosaic in your own project](https://mosaicjs.org/learn/introduction).
20
21## Installation
22
23Mosaic is available from npm:
24
25```bash
26$ npm i mosaic
27```
28
29You can also import Mosaic directly in the browser via CDN:
30
31```html
32<script type="module">
33 import { define } from "https://unpkg.com/mosaic@1.0.4"
34</script>
35```
36
37## Browser Support
38
39(todo)
40
41## Documentation
42
43(todo)
44
45## Example
46
47### Step 1. Define your custom element
48
49```html
50<script type="module">
51 import { define } from "https://unpkg.com/mosaic@1.0.4"
52
53 define("hello-world", () => ({ name }), "<p>Hello {{ name }}!</p>")
54</script>
55```
56
57### Step 2. Use the Custom Element
58
59```html
60<hello-world name="kimberley"></hello-world>
61```
62
63This example will render "Hello Kimberley!" into a container
64on the page.
65
66You'll notice that everything here is valid HTML and JS, and
67you can copy and paste this example and run it directly in
68the browser with no need to compile or install anything
69special to make it work.
70
71### License
72
73Mosaic is [MIT licensed](./LICENSE).