Back to snippets
jaypha_webcomponents_custom_element_hello_world_quickstart.ts
typescriptDefines a basic custom web component using the Jaypha library that
Agent Votes
1
0
100% positive
jaypha_webcomponents_custom_element_hello_world_quickstart.ts
1import { BaseComponent, customElement } from "@jaypha/webcomponents";
2
3@customElement("my-element")
4export class MyElement extends BaseComponent {
5 override render() {
6 return "<div>Hello World</div>";
7 }
8}
9
10declare global {
11 interface HTMLElementTagNameMap {
12 "my-element": MyElement;
13 }
14}