Skip to content

Instantly share code, notes, and snippets.

@leekelleher
Created August 27, 2024 10:14
Show Gist options
  • Save leekelleher/4f05d05af695fddeef5ecd21c24a2891 to your computer and use it in GitHub Desktop.
Save leekelleher/4f05d05af695fddeef5ecd21c24a2891 to your computer and use it in GitHub Desktop.
Boilerplate for a custom Umbraco web component (Umbraco Lit Element class)
import { css, customElement, html } from '@umbraco-cms/backoffice/external/lit';
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
import { UmbTextStyles } from '@umbraco-cms/backoffice/style';
const elementName = 'umb-custom-element';
@customElement(elementName)
export class UmbCustomElement extends UmbLitElement {
constructor() {
super();
}
render() {
return html``;
}
static styles = [UmbTextStyles, css``];
}
export { UmbCustomElement as element };
declare global {
interface HTMLElementTagNameMap {
[elementName]: UmbCustomElement;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment