@tiny-lit/core
v2.0.0-alpha.8
Published
Just another JavaScript library for building user interfaces using template literals
Downloads
266
Readme
@tiny-lit/core
Just another JavaScript library for building user interfaces using template literals
Usage
Html template
import { html, render } from '@tiny-lit/core';
const quote = message => html`
<div>
<blockquote>
${message}
</blockquote>
</div>
`;
render(
quote(
`
Neque porro quisquam est
qui dolorem ipsum quia dolor sit amet,
consectetur, adipisci velit
`
),
document.body
);
List of templates
import { html, render } from '@tiny-lit/core';
const listItem = item => (
html`<li>${item}</li>`.withKey(item)
);
const list = items => (
html`
<ul>
${items.map(listItem)}
</ul>
`
);
render(
list(['pippo', 'pluto', 'paperino']),
document.body
);