Svelte adds experimental custom renderers that skip the DOM
A new experimental.customRenderer flag lets a Svelte component tree target a terminal, a native UI or a PDF instead of the browser, using the same components, state and control flow.
Svelte can now render to something other than the DOM. At Svelte Summit in Ljubljana on 25 November, marking the framework’s tenth anniversary, the team shipped an experimental custom renderers feature: the same component syntax, state and control flow, but pointed at a different target, such as a terminal, a native mobile UI, a PDF, or a WebGL scene.
You opt in with experimental: { customRenderer: true } in your Vite config, then write a renderer with createRenderer, imported from svelte/renderer, implementing methods like createElement and createFragment for your target instead of the DOM:
import { createRenderer } from 'svelte/renderer';
export default createRenderer({
createElement(name) { /* ... */ },
createFragment() { /* ... */ }
// ...
});
Snippets can be passed between renderers, as long as every component involved was compiled with the flag on.
Why it matters: Svelte’s compiler has always assumed the browser DOM. This formalises an escape hatch so the same component model can drive a terminal UI or a native app without a separate framework bolted on from outside, useful if you want one component language across more than the web.
The caveat: this is explicitly experimental, behind a flag, with no stability guarantee. Don’t build anything you need to keep working on it yet.