feat(docs): add codepen for constructable stylesheets

This commit is contained in:
Ayo Ayco 2025-03-30 12:17:24 +02:00
parent 8d46650c27
commit c8c8eb90f3

View file

@ -57,6 +57,8 @@ customElements.define('styled-elements', StyledElement)
If you [use the Shadow DOM](/shadow-dom), you can add a `static styles` property of type string which will be added in the `shadowRoot`'s [`adoptedStylesheets`](https://developer.mozilla.org/en-US/docs/Web/API/Document/adoptedStyleSheets). If you [use the Shadow DOM](/shadow-dom), you can add a `static styles` property of type string which will be added in the `shadowRoot`'s [`adoptedStylesheets`](https://developer.mozilla.org/en-US/docs/Web/API/Document/adoptedStyleSheets).
Try it now with this [example on CodePen ↗](https://codepen.io/ayoayco-the-styleful/pen/JojmeEe?editors=1010)
```js ```js
class StyledElement extends WebComponent { class StyledElement extends WebComponent {
static shadowRootInit = { static shadowRootInit = {