Skip to content

Instantly share code, notes, and snippets.

@schalkneethling
Created February 15, 2025 17:47
Show Gist options
  • Save schalkneethling/6c6d7306c2fc377380b1d9acb8170ef6 to your computer and use it in GitHub Desktop.
Save schalkneethling/6c6d7306c2fc377380b1d9acb8170ef6 to your computer and use it in GitHub Desktop.
Web Component Patterns
export class NoteCard extends HTMLElement {
static #selectors = {
template: "#notecard",
title: ".notecard__title",
content: ".notecard__content",
};
#elements = {
template: this.querySelector(NoteCard.#selectors.template),
};
#data = {
type: this.getAttribute("type"),
};
constructor() {
super();
}
}
customElements.define("note-card", NoteCard);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment