Support custom styles

This commit is contained in:
Thomas Brouard 2022-05-24 10:49:24 +02:00
parent d0df158fcf
commit 6a3cc4f7c6
6 changed files with 35 additions and 3 deletions

View file

@ -22,6 +22,7 @@ class TabGroup extends HTMLElement {
// Create custom element
const shadow = this.attachShadow({mode: "open"});
this.shadow = shadow;
const wrapper = document.createElement("div");
wrapper.setAttribute("class", "etabs");
@ -77,6 +78,14 @@ class TabGroup extends HTMLElement {
this.emit("ready", this);
}
connectedCallback () {
const style = this.querySelector("style");
if (style) {
const clone = style.cloneNode(this);
this.shadow.appendChild(clone);
}
}
setDefaultTab (tab) {
this.options.defaultTab = tab;
}