xterm.js README

The project's README from github.com/xtermjs/xterm.js. As one markdown file: README.md.

xterm.js

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

What xterm.js is not

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:

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.

Do you use xterm.js in your application as well? Please open a Pull Request to include it here. We would love to have it on our list. Please add any new contributions to the end of the list.

License Agreement

If you contribute code to this project, you implicitly allow your code to be distributed under the MIT license. You are also implicitly verifying that all code is your original work.

Copyright (c) 2017-2026, The xterm.js authors (MIT License)
Copyright (c) 2014-2017, SourceLair, Private Company (www.sourcelair.com) (MIT License)
Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)

xterm.js (xtermjs/xterm.js)

Searching Database…

21.3K ·GitHub
What is this?Xterm.js is a frontend component that lets web applications embed a fully-featured terminal in the browser. It powers the integrated terminal in VS Code, Hyper and Tabby.
So is it a terminal I can install and use, or a building block for developers?It is a JavaScript library, not a ready-to-use terminal app: you embed it in your own web page or Electron app. It is not a shell either — it renders output and sends input for whatever process you connect to it.
How do I add it to a project?Install the @xterm/xterm package from npm (the only distribution channel), instantiate a Terminal, open it on a DOM element and write to it. Also include the css/xterm.css stylesheet.
What do I need to hook it up to a real shell?The library only renders; input and output come from a pseudoterminal API such as node-pty, usually driven by your backend. Extra features ship as separate addons — @xterm/addon-attach, for example, attaches to a server running a process via a websocket.
Does it handle real terminal apps like vim or tmux?Mostly, yes: bash, vim and tmux just work, including curses-based apps and mouse events, plus CJK, emojis and IME input. Extras like search, images, ligatures and web fonts come as opt-in addons.
Which browsers can I use it in?The latest versions of Chrome, Edge, Firefox and Safari are officially supported, since it is mainly used as a developer tool. It also works seamlessly in Electron apps and may work on older browser versions.
Is it actually fast, and what does the GPU renderer do?Yes: the README bills it as really fast, with an optional GPU-accelerated renderer available as the @xterm/addon-webgl addon, which draws the terminal through a canvas webgl2 context.
Which well-known apps are built on it?VS Code and its forks, Hyper, Tabby, JupyterLab, Proxmox VE, Azure Cloud Shell, RStudio, Replit and ttyd all use xterm.js for their terminal experience — it is the de facto standard terminal component for web apps.
How accessible is it for screen reader users?It ships an optional screen reader mode and a minimum contrast ratio setting; both can be turned on in the terminal options.
Are releases stable, or should I use the beta builds?Stable releases ship on an as-needed basis, while beta builds are published continuously from master. They are generally stable — VS Code itself uses near-latest betas — but can contain breaking changes, so use them mainly to test new features.
What are similar projects?upterm, chalk, ttyd, terminalizer, gpu.js, kitty, lenis, tfjs
Creator
xtermjs
Size
36.5 MB
Stars
21.3K
Age
12y
Commits · 90 Days