Xterm.js is a front-end component written in TypeScript that lets applications bring fully-featured terminals to their users in the browser. It’s used by popular projects such as VS Code, Hyper and Theia.
Terminal apps just work: Xterm.js works with most terminal apps such as bash, vim and tmux, this includes support for curses-based apps and mouse event support
Perfomant: Xterm.js is really fast, it even includes a GPU-accelerated renderer
Rich unicode support: Supports CJK, emojis and IMEs
Self-contained: Requires zero dependencies to work
Accessible: Screen reader support can be turned on using the screenReaderMode option
And much more: Links, theming, addons, well documented API, etc.
First you need to install the module, we ship exclusively through npm so you need that installed and then add xterm.js as a dependency by running:
npm install xterm
To start using xterm.js on your browser, add the xterm.js and xterm.css to the head of your html page. Then create a <div id="terminal"></div> onto which xterm can attach itself. Finally instantiate the Terminal object and then call the open function with the DOM object of the div.
<!doctype html><html><head><linkrel="stylesheet"href="node_modules/xterm/dist/xterm.css"/><script src="node_modules/xterm/dist/xterm.js"></script></head><body><divid="terminal"></div><script>varterm=newTerminal();term.open(document.getElementById('terminal'));term.write('Hello from \x1B[1;3;31mxterm.js\x1B[0m $ ')</script></body></html>
Xterm.js is used in several 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