<p>In this episode of Svelte Radio, we welcome Jeppe as a new permanent host and sit down with Paolo Ricciuti, Svelte maintainer and Senior Software Developer at Mainmatter, to dive deep into Svelte custom renderers. Paolo walks us through how custom renderers work (using React's approach with React DOM, Ink, and React Native as context), explains the technical challenges of bringing this capability to Svelte 5—including the template element trick, CSP issues, and runtime modifications—and shares his proof-of-concept work enabling Svelte to render to non-DOM targets like terminals and native mobile apps via Lynx.js. The discussion touches on potential use cases like Threlte for 3D graphics, the importance of this feature for Svelte adoption, and wraps up with picks including Screen Studio, TMCP, and Advent of Svelte.</p><p><strong><br>Guest</strong></p><ul><li><strong>Paolo Ricciuti</strong> — Svelte maintainer and ambassador, Senior Software Developer at <a href="https://mainmatter.com/svelte">Mainmatter</a></li></ul><p><strong><br>New Host</strong></p><ul><li><strong>Jeppe</strong> joins as a permanent co-host!</li></ul><p><strong><br>Topics Discussed</strong></p><p><strong><br>Custom Renderers Overview</strong></p><ul><li>Svelte Custom Renderers website</li><li>What custom renderers are and why they matter</li><li>How React separates React (the diffing library) from React DOM (the renderer)</li><li>Examples of React custom renderers: <ul><li><a href="https://github.com/vadimdemedes/ink">Ink</a> — React for terminal/CLI applications</li><li><a href="https://reactnative.dev/">React Native</a> — React for iOS/Android native apps</li><li><a href="https://www.remotion.dev/">Remotion</a> — React for programmatic video creation</li><li>React PDF renderer for generating documents</li></ul></li></ul><p><strong><br>Svelte's Technical Approach</strong></p><ul><li>How Svelte 5 uses the &lt;template&gt; element and innerHTML for fast rendering</li><li>The CSP (Content Security Policy) challenges with innerHTML</li><li>Paolo's compiler option contribution to enable programmatic element creation</li><li>The custom renderer API: defining operations like createElement, setText, setAttribute, appendChild, etc.</li><li>Separating the Svelte runtime from DOM-specific code</li></ul><p><strong><br>Lynx.js Integration</strong></p><ul><li><a href="https://lynxjs.org/">Lynx.js</a> — ByteDance's cross-platform framework (powers parts of TikTok)</li><li>Why Lynx was the catalyst for custom renderer work</li><li>CSS support in Lynx including Flexbox, Grid, and even Tailwind</li><li>The difference between Lynx's element approach vs React Native's component imports</li></ul><p><strong><br>Related Projects &amp; Discussions</strong></p><ul><li><a href="https://threlte.xyz/">Threlte</a> — Three.js for Svelte (created by Grisha)</li><li><a href="https://docs.pmnd.rs/react-three-fiber">React Three Fiber</a> — Three.js React renderer</li><li><a href="https://svelte-native.technology/">Svelte Native</a> — Existing (but limited) Svelte native solution</li><li>LiveView Native (Elixir/Phoenix) as a comparison for multi-target templating</li><li>Discussion with Grisha about mixing renderers in the same component</li></ul><p><strong><br>Funding &amp; Open Source</strong></p><ul><li>Mainmatter's sponsorship of Paolo's custom renderer work</li><li>First external sponsor for this initiative</li><li>Discussion about using Svelte Open Collective funds for this feature</li><li>Why custom renderers matter for Svelte adoption in enterprise</li></ul><p><strong><br>Paolo's Recent Contributions to Svelte</strong></p><ul><li>onChange callback for $state (PR in progress)</li><li>from action utility</li><li>CSP-friendly compiler option (foundational for custom renderers)</li></ul><p><strong><br>Picks</strong></p><ul><li><strong>Screen Studio</strong> — <a href="https://screen.studio/">screen.studio</a> — Mac screen recording app with automatic zoom animations (Kevin's pick, used for Advent of Svelte recordings)</li><li><strong>TMCP</strong> — <a href="https://github.com/paoloricciuti/tmcp">github.com/paoloricciuti/tmcp</a> — Paolo's TypeScript MCP (Model Context Protocol) framework, praised for being much better than the official SDK (Jeppe's pick)</li><li><strong>Advent of Svelte</strong> — <a href="https://svelte.dev/blog/advent-of-svelte">svelte.dev/blog/advent-of-svelte</a> — 24 days of Svelte features and improvements (Brittany's pick)</li></ul><p><strong><br>Links</strong></p><ul><li><a href="https://svelte.dev/">Svelte</a></li><li><a href="https://kit.svelte.dev/">SvelteKit</a></li><li><a href="https://mainmatter.com/svelte">Mainmatter</a> — Paolo's employer, specializing in Svelte and Rust consulting</li><li><a href="https://github.com/vadimdemedes/ink">Ink (React CLI)</a></li><li><a href="https://reactnative.dev/">React Native</a></li><li><a href="https://www.remotion.dev/">Remotion</a></li><li><a href="https://lynxjs.org/">Lynx.js</a></li><li><a href="https://threlte.xyz/">Threlte</a></li><li><a href="https://docs.pmnd.rs/react-three-fiber">React Three Fiber</a></li><li><a href="https://screen.studio/">Screen Studio</a></li><li><a href="https://github.com/paoloricciuti/tmcp">TMCP</a></li><li><a href="https://svelte.dev/blog/advent-of-svelte">Advent of Svelte</a></li></ul><p><strong><br>Follow</strong></p><ul><li>Paolo Ricciuti: <a href="https://github.com/paoloricciuti">GitHub</a> | <a href="https://bsky.app/profile/paolo.ricciuti.me">Bluesky</a></li><li>Svelte Radio: <a href="https://www.svelteradio.com/">svelteradio.com</a></li></ul>

Svelte Radio

Kevin Åberg Kultalahti

Custom Renderers for Svelte with Paolo Ricciuti

DEC 11, 202560 MIN
Svelte Radio

Custom Renderers for Svelte with Paolo Ricciuti

DEC 11, 202560 MIN

Description

In this episode of Svelte Radio, we welcome Jeppe as a new permanent host and sit down with Paolo Ricciuti, Svelte maintainer and Senior Software Developer at Mainmatter, to dive deep into Svelte custom renderers. Paolo walks us through how custom renderers work (using React's approach with React DOM, Ink, and React Native as context), explains the technical challenges of bringing this capability to Svelte 5—including the template element trick, CSP issues, and runtime modifications—and shares his proof-of-concept work enabling Svelte to render to non-DOM targets like terminals and native mobile apps via Lynx.js. The discussion touches on potential use cases like Threlte for 3D graphics, the importance of this feature for Svelte adoption, and wraps up with picks including Screen Studio, TMCP, and Advent of Svelte.GuestPaolo Ricciuti — Svelte maintainer and ambassador, Senior Software Developer at MainmatterNew HostJeppe joins as a permanent co-host!Topics DiscussedCustom Renderers OverviewSvelte Custom Renderers websiteWhat custom renderers are and why they matterHow React separates React (the diffing library) from React DOM (the renderer)Examples of React custom renderers: Ink — React for terminal/CLI applicationsReact Native — React for iOS/Android native appsRemotion — React for programmatic video creationReact PDF renderer for generating documentsSvelte's Technical ApproachHow Svelte 5 uses the <template> element and innerHTML for fast renderingThe CSP (Content Security Policy) challenges with innerHTMLPaolo's compiler option contribution to enable programmatic element creationThe custom renderer API: defining operations like createElement, setText, setAttribute, appendChild, etc.Separating the Svelte runtime from DOM-specific codeLynx.js IntegrationLynx.js — ByteDance's cross-platform framework (powers parts of TikTok)Why Lynx was the catalyst for custom renderer workCSS support in Lynx including Flexbox, Grid, and even TailwindThe difference between Lynx's element approach vs React Native's component importsRelated Projects & DiscussionsThrelte — Three.js for Svelte (created by Grisha)React Three Fiber — Three.js React rendererSvelte Native — Existing (but limited) Svelte native solutionLiveView Native (Elixir/Phoenix) as a comparison for multi-target templatingDiscussion with Grisha about mixing renderers in the same componentFunding & Open SourceMainmatter's sponsorship of Paolo's custom renderer workFirst external sponsor for this initiativeDiscussion about using Svelte Open Collective funds for this featureWhy custom renderers matter for Svelte adoption in enterprisePaolo's Recent Contributions to SvelteonChange callback for $state (PR in progress)from action utilityCSP-friendly compiler option (foundational for custom renderers)PicksScreen Studio — screen.studio — Mac screen recording app with automatic zoom animations (Kevin's pick, used for Advent of Svelte recordings)TMCP — github.com/paoloricciuti/tmcp — Paolo's TypeScript MCP (Model Context Protocol) framework, praised for being much better than the official SDK (Jeppe's pick)Advent of Svelte — svelte.dev/blog/advent-of-svelte — 24 days of Svelte features and improvements (Brittany's pick)LinksSvelteSvelteKitMainmatter — Paolo's employer, specializing in Svelte and Rust consultingInk (React CLI)React NativeRemotionLynx.jsThrelteReact Three FiberScreen StudioTMCPAdvent of SvelteFollowPaolo Ricciuti: GitHub | BlueskySvelte Radio: svelteradio.com