Skip to main content
239

Search Lumen

Find components, APIs, guides, and recipes.

GitHub
Themes
Web docs

Rust desktop guide: Tauri v2

Pair a compiled Rust backend with Lumen React, Web Components, or Dioxus in Tauri v2, or adopt Lumen tokens and presets in native GPUI desktop tools via the lumen-gpui-theme pilot.

Backend
Rust
Recipe
tauri-ai-workbench
Frontends
React · Elements · Dioxus

Lumen works inside Tauri v2 today with your existing React, Web Components, or Dioxus packages. Building a GPU-rendered native desktop app with Zed’s GPUI instead? See the dedicated GPUI guide for lumen-gpui-theme.

Tauri v2 frontend options

Keep local models, vector indexes, and filesystem operations in Rust while rendering Lumen’s accessible UI in Tauri’s system webview. Pair desktop tools with data-lumen-preset="studio" for dense layouts and hairline borders.

FrontendLumen adapterInstallBest for
React 19 + Vite@santi020k/lumen-reactpnpm add @santi020k/lumen-react @tauri-apps/apiAI workbenches, local RAG tools, and existing React teams migrating off Electron.
Web Components@santi020k/lumen-elementspnpm add @santi020k/lumen-elements @tauri-apps/apiLightweight HTML, Vanilla TS, Svelte, or Vue Tauri frontends with minimal JS.
Dioxus 0.7 (web)lumen-dioxuscargo add lumen-dioxusAll-Rust teams compiling Dioxus web WASM inside Tauri v2 while sharing Rust types.

Installable Tauri v2 AI workbench

The tauri-ai-workbench recipe installs a Studio-themed React workbench, a typed tauri::ipc::Channel streaming bridge with AbortSignal cancellation, a copy-ready Rust command module, and a least-privilege Tauri v2 capability file. Try the live local preview below before wiring it to a Tauri desktop window.

Loading Tauri AI workbench preview…

Install the recipe

bash
pnpm add @santi020k/lumen-react @tauri-apps/api
pnpm add -D @santi020k/lumen
pnpm exec lumen add tauri-ai-workbench --target react

Mount in your Tauri React app

tsx
import '@santi020k/lumen-react/styles.css'
import { Channel, invoke } from '@tauri-apps/api/core'

import { TauriAIWorkbench } from './lumen/tauri-ai-workbench'

export function App() {
  return (
    <TauriAIWorkbench
      runtime={{ Channel, invoke }}
      runtimeLabel="Local Rust IPC"
      title="Local AI Workbench"
    />
  )
}

Register commands in src-tauri/src/lib.rs

rust
// src-tauri/src/lib.rs
mod lumen_ai;

#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
    tauri::Builder::default()
        .manage(lumen_ai::CancellationRegistry::default())
        .invoke_handler(tauri::generate_handler![
            lumen_ai::lumen_stream_prompt,
            lumen_ai::lumen_cancel_stream,
            lumen_ai::lumen_resolve_approval,
        ])
        .run(tauri::generate_context!())
        .expect("error while running tauri application");
}

Streaming stays read-only; filesystem writes and external side effects remain gated behind ApprovalCard and your Rust lumen_resolve_approval handler. See Product workbenches for the shared conversation contract.

Web Components and Dioxus inside Tauri v2

Prefer minimal JavaScript or pure Rust in the webview? Both @santi020k/lumen-elements and lumen-dioxus work directly inside Tauri v2 without extra bridges.

Tauri v2 + Lumen Elements

ts
import '@santi020k/lumen-elements/styles.css'
import { defineLumenElements } from '@santi020k/lumen-elements'
import { invoke } from '@tauri-apps/api/core'

defineLumenElements()

document.documentElement.dataset.lumenPreset = 'studio'
document.documentElement.dataset.lumenScheme = 'dark'

// Bind native DOM events on <lumen-button> or <form> directly to Tauri commands.
document.querySelector('#run-check')?.addEventListener('click', () => {
  void invoke('run_local_check')
})

Tauri v2 + Dioxus WASM

toml
# Cargo.toml (frontend compiled to WASM inside Tauri v2)
[dependencies]
dioxus = { version = "0.7", features = ["web"] }
lumen-dioxus = "6.0"

Need full Dioxus renderer details (web, desktop, mobile, or Blitz Native)? Read the Dioxus guide. Looking for native GPU themes in Zed’s GPUI? Read the GPUI guide.

Choosing a Rust desktop UI stack

Pick the rendering model that matches your performance budget and catalog needs.

ApproachRendererStrengthsTrade-offs
Tauri v2 + Lumen (React, Elements, or Dioxus)OS native webviewFull web/CSS parity, low idle RAM (~50 MB), mature desktop and mobile plugins, fastest AI codegen.Uses platform webview engines (WebKit on macOS, WebView2 on Windows, WebKitGTK on Linux).
Dioxus Desktop / Dioxus Native (lumen-dioxus)System webview or Blitz GPUSingle Rust codebase across web, desktop, mobile, and SSR with full Lumen component coverage.Blitz Native 0.2 still has documented SVG, focus, and pointer limitations.
GPUI + lumen-gpui-theme (pilot)Direct GPU (Metal, Vulkan, DirectX)Zed-grade 120fps desktop performance, crisp text rendering, dense Studio preset and gpui-component ThemeSets.Desktop-first, pre-1.0 upstream API churn; Lumen provides themes/tokens/icons rather than full GPUI widget parity.
Web docsFull catalog