File size: 538 Bytes
d1a1dc1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
class CustomButton extends HTMLElement {
  connectedCallback() {
    this.attachShadow({ mode: 'open' });
    this.shadowRoot.innerHTML = `
      <style>
        button {
          background: #667eea;
          color: white;
          padding: 0.5rem 1rem;
          border-radius: 0.375rem;
          transition: all 0.3s ease;
        }
        button:hover {
          background: #5a67d8;
        }
      </style>
      <button>
        <slot></slot>
      </button>
    `;
  }
}
customElements.define('custom-button', CustomButton);