Get Started

Install

React

npm install @wterm/dom @wterm/react

Vanilla JS

npm install @wterm/dom

The WASM binary is embedded in the package — no extra setup required.

Quick Start

React

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

function App() {
  const { ref, write } = useTerminal();

  return (
    <Terminal
      ref={ref}
      onData={(data) => write(data)}
    />
  );
}

Vanilla JS

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

const term = new WTerm(document.getElementById("terminal"), {
  cols: 80,
  rows: 24,
  onData(data) {
    term.write(data);
  },
});

await term.init();

Serving WASM separately

By default the ~12 KB WASM binary is loaded from the JS bundle. 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" />

Building the WASM Binary

Requires Zig 0.15.2+:

zig build -Doptimize=ReleaseSmall

The compiled binary is output to web/wterm.wasm.