Example 13: SSR + Declarative Shadow DOM

Server-render HTML + encapsulated styles before JavaScript boots

What This Shows

This example demonstrates a practical combo: SSR output for immediate content + Declarative Shadow DOM for style encapsulation without waiting for client rendering.

The cards below are rendered in HTML with <template shadowrootmode="open">, then upgraded with minimal JS.

Checking support…

SSR Snapshot (Server Output)

Typical HTML the server can stream immediately:

<product-preview>
  <template shadowrootmode="open">
    <style>/* isolated card styles */</style>
    <article class="card">
      <slot name="name"></slot>
      <slot name="meta"></slot>
      <button id="quickAdd">Quick add</button>
    </article>
  </template>
  <h3 slot="name">Keyboard KX-87</h3>
  <p slot="meta">$129 · Stock: 24</p>
</product-preview>

Live DSD Cards (No client templating)

Buttons are wired after load to prove progressive enhancement / hydration style behavior.

Keyboard KX-87

Mechanical · Stock: 24

Mouse MX Pro

Wireless · Stock: 58

Monitor 27Q

QHD · Stock: 12

[ready] waiting for actions…

Notes

Documentation

Next Step