gitmyhub

xterm.js

TypeScript ★ 21k updated 1d ago

A terminal for the web

A web component that embeds a fully working terminal inside a browser page, used by VS Code and browser-based IDEs to let users run real shell commands without leaving the browser.

TypeScriptWebGLNode.jsnpmsetup: moderatecomplexity 3/5

Xterm.js is a building-block component for web developers that puts a fully working terminal — the kind of black, blinking-cursor command-line window you see on a computer — inside a web page. It powers the integrated terminal in VS Code and its forks, and standalone apps like Tabby and Hyper.

Xterm.js is not a terminal app you download, and it is not bash. It is a front-end widget that draws the terminal screen and handles keyboard input; you connect it to a real shell (such as bash) through a separate library like node-pty. Keystrokes flow from the browser into the shell, and the shell's output is streamed back and rendered. It works with most terminal applications, including curses-based ones like vim and tmux, and supports mouse events. It has rich Unicode support (CJK, emojis, IMEs), an optional GPU-accelerated renderer, screen-reader and contrast settings, configurable theming and custom glyphs, and a documented API.

Extra functionality lives in optional addons you install separately: fitting the terminal to its container, attaching to a remote process over WebSocket, clipboard access, search, image rendering, font ligatures, web-link detection, a WebGL renderer, serializing the buffer to VT escape sequences or HTML, and Unicode helpers.

You would use xterm.js if you are building anything in the browser that needs a real terminal — a cloud IDE, an SSH client, a browser-based admin console, or an Electron desktop app. It is written in TypeScript with zero runtime dependencies in the core, distributed on npm as @xterm/xterm, and a headless build (@xterm/headless) is also available for Node.js. Supported browsers are the latest Chrome, Edge, Firefox, and Safari.

Where it fits