summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar tobi-or-not-tobi <tobi-or-not-tobi@users.noreply.github.com> 2021-08-03 14:18:11 +0200
committerGravatar GitHub <noreply@github.com> 2021-08-03 08:18:11 -0400
commit418bc1d91cb40d2cc050a4e5b519c12c8cc590c8 (patch)
tree58661b3b180d7dfae6e4ed7db589a5fd9a5930cb
parent27672096f504c567dadd2540fa0e21be59924483 (diff)
downloadastro-418bc1d91cb40d2cc050a4e5b519c12c8cc590c8.tar.gz
astro-418bc1d91cb40d2cc050a4e5b519c12c8cc590c8.tar.zst
astro-418bc1d91cb40d2cc050a4e5b519c12c8cc590c8.zip
Improve code sample for lit integration (#991)
Align the lit component with the astro import and usage of it.
-rw-r--r--packages/renderers/renderer-lit/readme.md10
1 files changed, 6 insertions, 4 deletions
diff --git a/packages/renderers/renderer-lit/readme.md b/packages/renderers/renderer-lit/readme.md
index 91ae2f390..ed36f9dbd 100644
--- a/packages/renderers/renderer-lit/readme.md
+++ b/packages/renderers/renderer-lit/readme.md
@@ -36,13 +36,15 @@ __src/components/my-element.js__
```js
import { LitElement, html } from 'lit';
-export const tagName = 'my-counter';
-
-class Counter extends LitElement {
+export const tagName = 'my-element';
+class MyElement extends LitElement {
+ render() {
+ return html` <p>Hello world! From my-element</p> `;
+ }
}
-customElements.define(tagName, Counter);
+customElements.define(tagName, MyElement);
```
> Note that exporting the `tagName` is __required__ if you want to use the tag name in your templates. Otherwise you can export and use the constructor, like with non custom element frameworks.