feat(web-components): add SSR support via Declarative Shadow DOM modules#36247
Merged
radium-v merged 44 commits intoMay 27, 2026
Merged
Conversation
📊 Bundle size report✅ No changes found |
|
Pull request demo site: URL |
radium-v
commented
May 26, 2026
tudorpopams
approved these changes
May 26, 2026
b80881f to
3ebabb7
Compare
ac9d18f to
7531a73
Compare
7531a73 to
4601fe9
Compare
radium-v
commented
May 27, 2026
b5d30b7 to
d525a47
Compare
davatron5000
approved these changes
May 27, 2026
d525a47 to
c80688c
Compare
marchbox
approved these changes
May 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previous Behavior
@fluentui/web-componentshad no server-side rendering path. Components were defined and rendered only on the client, so SSR frameworks could not pre-render Fluent web components into HTML and hydrate them on load.The e2e tests ran against a custom harness that only covered client-side rendering.
New Behavior
@fluentui/web-componentsnow supports SSR via Declarative Shadow DOM, built on@microsoft/fast-elementand@microsoft/fast-html. Every component in the package ships a paireddefine-async.ts/*.definition-async.tsmodule so its template can render on the server and hydrate on the client.The build also emits two new asset types alongside the JS modules, one pair per component (42 of each), exposed through new package subpath exports:
@fluentui/web-components/<component>/template.html: declarative HTML template wrapped in<f-template>, consumed by@microsoft/fast-htmlto render Declarative Shadow DOM on the server.@fluentui/web-components/<component>/styles.css: plain CSS extracted from the component's styles, importable as a raw stylesheet without pulling in the component's JS.Currently, the SSR templates and styles are generated at build time and placed in the
distoutput, but we may want to provide them as src assets in the future for easier consumption and customization.New test harness modules (
test/src/entry-client.ts,test/src/entry-server.ts) and atest/ssr.htmlentry point template exercise the DSD output end-to-end. The e2e pipeline runs SSR tests after CSR tests.Several components needed template or base adjustments to render correctly under SSR: tooltip (anchor positioning polyfill handling), text-input, textarea, tree, and tree-item. The
theme/set-themetests are skipped under SSR.Next Steps
This PR lays the groundwork for SSR support in
@fluentui/web-components, but there are still some follow-up tasks to complete:@microsoft/fast-elementand remove the@microsoft/fast-htmldependency, as DSD rendering will be directly supported in FAST in the next major release.