Get Started

Install

React

npm install @wterm/dom @wterm/react

Vue

npm install @wterm/dom @wterm/vue

Svelte

npm install @wterm/dom @wterm/svelte svelte

Vanilla JS

npm install @wterm/dom

The WASM binary is embedded in the package — no extra setup required. It is decoded and compiled once per copy of @wterm/core, including concurrent loads. Each terminal still gets its own instance and memory.

Quick Start

React

import { Terminal } from "@wterm/react";
import "@wterm/react/css";

function App() {
  return <Terminal />;
}

Vue

<script setup lang="ts">
import { Terminal } from "@wterm/vue";
import "@wterm/vue/css";
</script>

<template>
  <Terminal />
</template>

Svelte

<script lang="ts">
import { Terminal } from "@wterm/svelte";
import "@wterm/svelte/css";
</script>

<Terminal />

Vanilla JS

import { WTerm } from "@wterm/dom";
import "@wterm/dom/css";

const term = new WTerm(document.getElementById("terminal"));
await term.init();

Serving WASM separately

By default the ~49 KB WASM binary is embedded in the package and imported when the built-in core is first loaded. Bundlers with code splitting emit it in a separate JavaScript chunk, so deploy all emitted application assets. Ghostty and custom wasmUrl loads do not request that chunk. To serve it as a separate static file instead (for caching or CDN), copy it from the package and pass wasmUrl:

cp node_modules/@wterm/core/wasm/wterm.wasm public/wterm.wasm
<Terminal wasmUrl="/wterm.wasm" />

Loads of the same resolved URL share the download and compiled module. The built-in loader retains up to four recently used URLs per copy of @wterm/core in a page or worker, separately from its embedded module. Failed downloads and compilations can be retried. Use versioned or hashed URLs when updating the binary; cached modules remain until eviction or page/worker reload.

Serve Content-Type: application/wasm to compile during download in supported browsers. Other MIME types, unavailable streaming, or streaming failures fall back to buffered compilation without fetching the file again.

Building the WASM Binary

Requires Zig 0.16.0

zig build -Doptimize=ReleaseSmall

The build writes zig-out/bin/wterm.wasm and web/wterm.wasm. The packages ship packages/@wterm/core/wasm/wterm.wasm. Copy the build there, then run pnpm --filter @wterm/core build to regenerate the embedded binary that loads when wasmUrl is not set.