#5359·lit

[labs/ssr] Support scoped custom elements

Author: tomherniCreated Jul 9, 2026Updated Jul 9, 2026

Should this be an RFC?

  • This is not a substantial change

Which package is this a feature request for?

SSR (@lit-labs/ssr)

Description

Lit SSR should support scoped custom elements. Currently, only custom elements defined in the global registry are rendered on the server. Scoped elements, whether via the (limited available) spec or using @lit-labs/scoped-registry-mixin, are not recognized.

At ING, many custom elements with meaningful content are defined in scoped registries. Rendering scoped elements on the server could be a way to improve e.g. SEO and GEO.

I suppose that supporting the spec would mean that first LitElement should support scoped elements. Also, given the spec's limited availability, it is likely that the mixin + polyfill will still be used for quite a while longer. I personally think it makes sense to start with support for the Lit Labs mixin (but keeping the spec in mind).

I've quickly experimented with local node_modules changes to render scoped elements on the server (both spec and mixin). It took just a few lines of code changes to get a basic happy flow working (rendering only, not hydration etc.), which sparked the motivation to open this issue, and perhaps provide my changes as an initial contribution.

PS. There is this issue which I didn't consider a duplicate as it's defined as a simple task to see if scoped elements work, to which we know the answer is No.