Skip to main content

Integrate with the web

Before you start: document delivery.

The framework-independent @relo-ui/web SDK runs the shared Rust engine through Wasm and renders DOM controls. React hosting is optional through @relo-ui/react.

These packages are currently built from the checkout. Follow the web workspace guide; public packages are not published.

Mount in an existing element​

import {ReloUI, RemoteDocument} from '@relo-ui/web';
import wasmUrl from '@relo-ui/web/wasm?url'; // Vite asset integration

const runtime = await ReloUI.create({wasmUrl});
const session = runtime.session(RemoteDocument.create({
source: '<Text text="Hello, web" />',
}));
const surface = runtime.mount(document.getElementById('screen')!, {session});

// On final disposal:
surface.dispose();
session.close();

Initialize the runtime and sessions on the client. Imports are server-safe, but a live surface is a client-rendered island. Serve Wasm with application/wasm and correct CSP/CORS for the deployment.

Add Components or React​

Call installComponents(runtime) from @relo-ui/components before sessions. It installs shared component support services; XML definitions still come from your assembled document.

With React, useRemoteSession owns the logical session and closes it on final unmount. Use RemoteView to attach it, or pass a session that the host owns. See the React package guide for provider context and Strict Mode behavior.

Test platform details​

The web adapter uses browser controls, fonts, editing, scrolling, and asset policies. Shared documents don't imply identical pixels or complete native parity. The coverage ledger records tested behavior and remaining release gates.