Skip to content

xterm.js

A front-end component that puts a fully featured terminal inside a web page.

Stars
21.3k
Forks
2k
Licence
MIT
Language
TypeScript
Last update
7 days ago
Type
Library

What it is

Xterm.js is a JavaScript and TypeScript component that lets a web app show a working terminal to its users in the browser. It handles display and keyboard input, while a separate process such as a shell is connected through a pseudoterminal library like node-pty. It is used by VS Code, Tabby and Hyper to provide their built-in terminals.

  • Embed a terminal in a web page and write colored output to it with term.write
  • Connect the terminal to a shell through node-pty so users can type commands in the browser
  • Add clickable web links, search, or image support using the official addons
  • Save and restore terminal state across reconnects with the serialize addon and headless package

Great for

  • Developers building a browser-based IDE or cloud workspace that needs an integrated terminal
  • Teams adding a web console to a server or device management tool
  • Projects that already use Node.js and npm and want a terminal component
  • Developers who need to run headless terminal state tracking in Node.js via @xterm/headless

Not ideal for

  • People who want a terminal app to install on their computer, since the README says xterm.js is not a terminal application
  • Users who only want to run bash or tmux directly, since xterm.js needs a host app and a backend process to be useful
  • Non-developers, because it is a library that must be wired into code
Step-by-step guide: how to use xterm.jsInstall, first run, examples, tips and FAQs

How to get it

  1. 1

    Install with a package manager

    You'll need: npm

    Install the module

    npm install --save @xterm/xterm
  2. 2

    Run it

    • Install the package with npm install --save @xterm/xterm
    • Import Terminal from '@xterm/xterm' and create a new Terminal object
    • Call term.open() on a DOM element and include css/xterm.css
    • Use term.write() to display output and term.onData() to send input to a process
  3. 3

    Get the most out of it

    • Load the official addons such as fit, webgl, search, and web-links with terminal.loadAddon
    • Use the beta build with npm install --save @xterm/xterm@beta if you want to test upcoming features, understanding the stability trade-off in the README
    • Use @xterm/headless in Node.js with the serialize addon to keep terminal state for reconnection
    • Read the TypeScript declaration file for the full API

Downloads

Strengths

  • The README says it works with common terminal apps such as bash, vim, and tmux, including mouse events
  • The core library has zero dependencies, according to the README
  • Supports CJK, emoji, and IME input, plus an optional GPU-accelerated renderer

Trade-offs

  • The README says it is only officially supported in the latest evergreen browsers, so older browsers may not work
  • Experimental APIs can change between versions without the usual semver guarantees
  • It ships only through npm, so it is not a standalone download

How it compares

ProjectStarsTypeLevelUpdatedBest for
xterm.js (this)21.3kLibraryintermediate7 days agoDevelopers building a browser-based IDE or cloud workspace that needs an integrated terminal
ttyd12.6kDev toolintermediate3 months agoDevelopers who want to open a shell on a home server or device from a browser
upterm19kAppintermediate7.5 years agoDevelopers who want to try an Electron-based terminal with autocompletion
chalk23.3kLibrarybeginner14 days agoNode.js developers building command-line tools that print colored output
Terminal.Gui11.3kLibraryintermediate7 days agoC# / .NET developers building terminal tools with forms, tables or menus
FTXUI10.9kLibraryintermediate5 days agoC++ developers who want interactive text-based tools in the terminal

Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.