wcb/demo/examples/constructed-styles/index.html
Ayo 133881a127
Some checks are pending
Tests / Unit (push) Waiting to run
Tests / E2E (push) Waiting to run
feat: composing stylesheets
2026-07-19 21:19:01 +02:00

31 lines
1.1 KiB
HTML

<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Constructable styles</title>
<script type="module" src="./index.js"></script>
<script>try{document.documentElement.dataset.theme=localStorage.getItem('wcb-theme')||(matchMedia('(prefers-color-scheme: dark)').matches?'dark':'light')}catch(e){}</script>
<link rel="stylesheet" href="../../shell.css" />
<script type="module" src="../../shell.js"></script>
</head>
<body>
<h1>Constructable styles</h1>
<p>
<code>static styles</code> is adopted into the shadow root as a
constructable stylesheet. It takes a single string, or an array adopted in
order.
</p>
<h2>A single string</h2>
<styled-elements type="warn" condition></styled-elements>
<h2>An array of sheets</h2>
<p>
Shared tokens, then a ready-made <code>CSSStyleSheet</code>, then local
styles — so a design system composes a base sheet with per-component CSS
instead of inlining the base in every component.
</p>
<composed-styles></composed-styles>
</body>
</html>