Skip to content

Svelte Renderer #302

@zahlekhan

Description

@zahlekhan

Is your feature request related to a problem? Please describe.
OpenUI is currently React-only. Developers building Svelte or SvelteKit applications cannot use OpenUI's streaming renderer to progressively render OpenUI Lang output. This excludes the growing Svelte ecosystem from adopting OpenUI for generative UI.

Describe the solution you'd like
Create a new @openuidev/svelte-lang package that provides the core OpenUI Lang renderer for Svelte. This includes:

  1. Svelte renderer — A Svelte equivalent of the React Renderer component that can parse OpenUI Lang streams and progressively render registered Svelte components as tokens arrive.
  2. Component definition API — A Svelte-idiomatic way to define and register components (equivalent to defineComponent and createLibrary in react-lang), leveraging Svelte stores and reactivity where appropriate.
  3. Prompt generation — Reuse or adapt the existing prompt generation logic so Svelte component libraries can generate system prompts the same way React ones do.
  4. Streaming parser — Reuse the core parser (createParser, createStreamingParser) from react-lang since parsing is framework-agnostic, and only implement the Svelte rendering layer on top.
  5. Example app — A standalone SvelteKit example app in examples/ (e.g., examples/svelte-chat) demonstrating the Svelte renderer with streaming OpenUI Lang output, similar in scope to examples/openui-chat.

Describe alternatives you've considered

  • Embedding React inside Svelte via wrapper libraries, but this defeats the purpose of using Svelte and adds significant overhead.
  • A Web Components-based renderer that could work in any framework, but this would lose Svelte-specific features like fine-grained reactivity, stores, and transitions.

Additional context
The core parser logic in packages/react-lang is largely framework-agnostic — the framework-specific part is the rendering layer. The Svelte package should reuse as much of the parsing and prompt generation logic as possible, only implementing Svelte-specific rendering and component registration. Svelte 5 with runes should be the target version.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions