Coming from ghostty-web
ghostty-webgpu has its own native API. Start with a working terminal and move the transport before changing appearance.
Map the integration
Section titled “Map the integration”| ghostty-web | ghostty-webgpu |
|---|---|
| Separate initialization and terminal construction | Await Terminal.create, then await open |
| String input callbacks | onData emits Uint8Array bytes |
| Canvas renderer | Automatic WebGPU, WebGL2, Canvas 2D and DOM selection |
| Fit addon | Fit to the sized host automatically |
| Font size and family options | appearance.font, then setFont |
| Theme colors | TerminalTheme RGB objects and a 256-entry palette |
| Main-thread terminal | Main entry or dedicated /worker entry |
These mappings describe ghostty-web 0.4.0 and the current ghostty-webgpu checkout. Check the xterm.js mapping for more API names; the native API takes a different shape from the xterm-style facade.
Keep input as bytes
Section titled “Keep input as bytes”Send onData bytes directly to your PTY. Set the socket to arraybuffer and pass binary output into write. The PTY client includes resize and disposal.
Load fonts before fitting
Section titled “Load fonts before fitting”Use browser font loading for the main entry. Supply font URLs or bytes to the worker entry so its own font set can measure and render them.
Check your feature needs
Section titled “Check your feature needs”URL detection, OSC 8 links and native widths are available. Search, images and ligatures remain planned. Worker link providers and finite synchronous hotkeys have capability limits. Compare current versions and renderer classes through the benchmark report.