wcb/examples/constructed-styles/index.js

30 lines
496 B
JavaScript

// @ts-check
import { WebComponent, html } from '../../src/index.js'
class StyledElements extends WebComponent {
static shadowRootInit = {
mode: 'open',
}
static styles = `
div {
background-color: yellow;
border: 1px solid black;
padding: 1em;
p {
text-decoration: underline;
}
}
`
get template() {
return html`
<div>
<p>Wow!?</p>
</div>
`
}
}
customElements.define('styled-elements', StyledElements)