Xterm.js
A terminal for the web
Install / Use
/learn @xtermjs/Xterm.jsREADME
Xterm.js is a frontend component that enables applications to bring fully-featured terminals to their users in the browser. It's used by popular projects such as VS Code (and its forks), Tabby and Hyper.
Features
- Terminal apps just work: Xterm.js works with most terminal apps such as
bash,vim, andtmux, including support for curses-based apps and mouse events. - Performant: Xterm.js is really fast and includes an optional GPU-accelerated renderer.
- Rich Unicode support: Supports CJK, emojis, and IMEs.
- Self-contained: The core library has zero dependencies.
- Accessible: Screen reader mode and minimum contrast ratio support can be turned on.
- And much more: Links, theming, custom glyphs, addons, well documented API, etc.
What xterm.js is not
- Xterm.js is not a terminal application that you can download and use on your computer.
- Xterm.js is not
bash. Xterm.js can be connected to processes likebashand let you interact with them (provide input, receive output) through a library like node-pty.
Getting Started
First, you need to install the module. We ship exclusively through npm, so you need that installed and then add @xterm/xterm as a dependency by running:
npm install --save @xterm/xterm
The recommended way to load xterm.js with the ES module syntax, either using TypeScript or a modern JS tooling. Note that both CommonJS and ES module files are shipped with the npm package.
import { Terminal } from '@xterm/xterm';
Then instantiate a Terminal object, open it on an element and write to it:
const term = new Terminal();
term.open(document.getElementById('terminal'));
term.write('Hello from \x1B[1;3;31mxterm.js\x1B[0m $ ')
Most use cases will hook up input and output to a pseudoterminal API such as node-pty which will drive the terminal.
pty.onData(data => term.write(data));
term.onData(data => pty.write(data));
Then make sure to also include the css/xterm.css file, for example in HTML:
<link rel="stylesheet" href="node_modules/@xterm/xterm/css/xterm.css" />
Standalone example
Here is a complete standalone example in a HTML file:
<!doctype html>
<html>
<head>
<link rel="stylesheet" href="node_modules/@xterm/xterm/css/xterm.css" />
<script src="node_modules/@xterm/xterm/lib/xterm.js"></script>
</head>
<body>
<div id="terminal"></div>
<script>
const term = new Terminal();
term.open(document.getElementById('terminal'));
term.write('Hello from \x1B[1;3;31mxterm.js\x1B[0m $ ')
</script>
</body>
</html>
Addons
Addons are separate modules that extend the Terminal by building on the xterm.js API. To use an addon, you first need to install it in your project:
npm install --save @xterm/addon-web-links
Then import the addon, instantiate it and call Terminal.loadAddon:
import { Terminal } from '@xterm/xterm';
import { WebLinksAddon } from '@xterm/addon-web-links';
const terminal = new Terminal();
// Load WebLinksAddon on terminal, this is all that's needed to get web links
// working in the terminal.
terminal.loadAddon(new WebLinksAddon());
The xterm.js team maintains the following addons, but anyone can build them:
@xterm/addon-attach: Attaches to a server running a process via a websocket@xterm/addon-clipboard: Access the browser's clipboard@xterm/addon-fit: Fits the terminal to the containing element@xterm/addon-image: Adds image support@xterm/addon-ligatures: Enables rendering of ligatures@xterm/addon-progress: Adds support for the progress API (OSC 9;4)@xterm/addon-search: Adds search functionality@xterm/addon-serialize: Serializes the terminal's buffer to VT sequences or HTML@xterm/addon-unicode-graphemes: Enhanced unicode support including grapheme clustering (experimental)@xterm/addon-unicode11: Updates character widths to their unicode11 values@xterm/addon-web-fonts: Easily integrate web fonts@xterm/addon-web-links: Adds web link detection and interaction@xterm/addon-webgl: Renders xterm.js using acanvaselement's webgl2 context
Browser Support
Since xterm.js is typically implemented as a developer tool, generally only modern evergreen browsers are supported officially. Specifically the latest versions of Chrome, Edge, Firefox, and Safari. Xterm.js also works seamlessly in Electron apps and may even work on earlier versions of the browsers. These are the versions we strive to keep working.
Node.js Support
We also publish @xterm/headless which is a stripped down version of xterm.js that runs headless in Node.js. An example use case for this is to keep track of a terminal's state where the process is running and using the serialize addon so it can get all state restored upon reconnection.
API
The full API for xterm.js is contained within the TypeScript declaration file, use the branch/tag picker in GitHub (w) to navigate to the correct version of the API.
Some APIs may be marked with experimental, these are added to enable experimentation with new ideas without committing to support it like a normal semver API. Note that these APIs can change radically between versions, so be sure to read release notes if you plan on using experimental APIs.
Releases
Stable releases are done on an as needed basis. All current and past releases are available on this repo's releases page, you can see what's planned for upcoming releases looking through the repository milestones.
Beta builds
Beta releases are continuously published off the master branch. Install the latest beta build with:
npm install --save @xterm/xterm@beta
The principal implementation (VS Code) typically uses the latest or near the latest beta build. Generally they are quite stable but can potentially contain bugs or breaking changes. If stability is very important we recommend using the beta build primarily to test out new features and to verify bug fixes, unless you're tracking what's landing and are comfortable taking that risk.
Contributing
Read CONTRIBUTING.md to learn how to contribute to the project.
Real-world uses
Xterm.js is used in many world-class applications to provide great terminal experiences.
- SourceLair: In-browser IDE that provides its users with fully-featured Linux terminals based on xterm.js.
- Microsoft Visual Studio Code: Modern, versatile, and powerful open source code editor that provides an integrated terminal based on xterm.js.
- ttyd: A command-line tool for sharing terminal over the web, with fully-featured terminal emulation based on xterm.js.
- Eclipse Che: Developer workspace server, cloud IDE, and Eclipse next-generation IDE.
- Codenvy: Cloud workspaces for development teams.
- CoderPad: Online interviewing platform for programmers. Run code in many programming languages, with results displayed by xterm.js.
- WebSSH2: A web based SSH2 client using xterm.js, socket.io, and ssh2.
- Spyder Terminal: A full fledged system terminal embedded on Spyder IDE.
- Cloud Commander: Orthodox web file manager with console and editor.
- Next Tech: Online platform for interactive coding and web development courses. Live container-backed terminal uses xterm.js.
- RStudio: RStudio is an integrated development environment (IDE) for R.
- Terminal for Atom: A simple terminal for the Atom text editor.
- Eclipse Orion: A modern, open source software development environment that runs in the cloud. Code, deploy, and run in the cloud.
- Gravitational Teleport: Gravitational Teleport is a modern SSH server for remotel
Related Skills
canvas
329.0kCanvas Skill Display HTML content on connected OpenClaw nodes (Mac app, iOS, Android). Overview The canvas tool lets you present web content on any connected node's canvas view. Great for: -
node-connect
329.0kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
81.1kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
Writing Hookify Rules
81.1kThis skill should be used when the user asks to "create a hookify rule", "write a hook rule", "configure hookify", "add a hookify rule", or needs guidance on hookify rule syntax and patterns.

