https://github.com/atomicojs/lit-html
https://github.com/atomicojs/lit-html
Last synced: 12 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/atomicojs/lit-html
- Owner: atomicojs
- Created: 2022-06-17T04:54:11.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2022-10-17T13:20:21.000Z (over 3 years ago)
- Last Synced: 2025-06-27T00:38:15.682Z (about 1 year ago)
- Language: TypeScript
- Size: 16.6 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# @atomico/lit-html
[](https://discord.gg/7z3rNhmkNE) [](https://twitter.com/atomicojs)
`@atomico/lit-html` will allow you to use lit-html within Atomico, example:
```js
import { c } from "atomico";
import { html } from "@atomico/lit-html";
function component() {
return html`
Atomico + lit-html
`;
}
```
The first html return must always come from the `@atomico/lit-html` model, since atomico adds the render method to this function, which allows atomico to render any library.
## Objectives.
1. Support lit-html as an optional renderer for developers who are comfortable with lit-html.
2. Give declarative support to the use of the shadowDom.
3. Support references, to share hooks between Atomico, lit-html, react and react.
## shadowDom
```js
import { c } from "atomico";
import { html } from "@atomico/lit-html";
function component({ message }: Props) {
html.shadowDom = true;
return html`
Welcome to ${message}!
`;
}
component.props = {
message: { type: String, value: "Atomico" },
};
customElements.define("my-component", c(component));
```
## useRender
Homologous hook of useRender from [@atomico/hooks/use-render](https://atomico.gitbook.io/doc/atomico/atomico-hooks/use-render).
```js
import { useRender } from "@atomico/lit-html";
function component() {
useRender(() => html``);
}
```
## ref
Allows the use of Atomico references within lit-html.
```js
import { useRef } from "atomico";
import { ref } from "@atomico/lit-html";
function component() {
const refInput = useRef();
return html``;
}
```