# @xterm/addon-webgl

> An addon for [xterm.js](https://github.com/xtermjs/xterm.js) that enables a WebGL2-based renderer. This addon requires xterm.js v4+.

Latest version **0.19.0** (published 2025-12-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install @xterm/addon-webgl
pnpm add @xterm/addon-webgl
yarn add @xterm/addon-webgl
bun add @xterm/addon-webgl
```

## Health

**Score 65/100 (B)** — status: stable.

Positive: has types; esm support; no vulnerabilities; high maintenance score; popular repo.

Warnings: low downloads; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.19.0 |
| Published | 2025-12-22 |
| First published | 2023-11-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 2.2 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 21197 |
| Author | The xterm.js authors |
| Maintainers | tyriar |
| Keywords | terminal, webgl, xterm, xterm.js |

## Links

- npm: https://www.npmjs.com/package/@xterm/addon-webgl
- Repository: https://github.com/xtermjs/xterm.js.git#master
- Homepage: https://github.com/xtermjs/xterm.js/tree/master#readme
- Issues: https://github.com/xtermjs/xterm.js/issues
- npm.io page: https://npm.io/package/@xterm/addon-webgl

## Alternatives

- [localforage](https://npm.io/package/localforage.md) — 6.2M weekly downloads
- [localforage-observable](https://npm.io/package/localforage-observable.md) — 30.8K weekly downloads
- [@y/y](https://npm.io/package/@y/y.md) — 30.1K weekly downloads
- [@metaobjectsdev/render](https://npm.io/package/@metaobjectsdev/render.md) — 3.5K weekly downloads
- [@ledgerhq/coin-algorand](https://npm.io/package/@ledgerhq/coin-algorand.md) — 1.1K weekly downloads

## Recent versions

- 0.19.0 (latest) — 2025-12-22
- 0.20.0-beta.300 (beta) — 2026-08-30
- 0.20.0-beta.299 — 2026-08-24
- 0.20.0-beta.298 — 2026-08-10
- 0.20.0-beta.297 — 2026-08-09
- 0.20.0-beta.296 — 2026-08-09
- 0.20.0-beta.295 — 2026-08-09
- 0.20.0-beta.294 — 2026-08-09
- 0.20.0-beta.293 — 2026-08-09
- 0.20.0-beta.292 — 2026-08-09
- 0.20.0-beta.291 — 2026-07-27
- 0.20.0-beta.290 — 2026-07-19
- 0.20.0-beta.289 — 2026-07-15
- 0.20.0-beta.288 — 2026-07-13
- 0.20.0-beta.287 — 2026-06-28
- … 477 more at https://npm.io/package/@xterm/addon-webgl/versions

## README

## @xterm/addon-webgl

An addon for [xterm.js](https://github.com/xtermjs/xterm.js) that enables a WebGL2-based renderer. This addon requires xterm.js v4+.

### Install

```bash
npm install --save @xterm/addon-webgl
```

### Usage

```ts
import { Terminal } from '@xterm/xterm';
import { WebglAddon } from '@xterm/addon-webgl';

const terminal = new Terminal();
terminal.open(element);
terminal.loadAddon(new WebglAddon());
```

See the full [API](https://github.com/xtermjs/xterm.js/blob/master/addons/addon-webgl/typings/addon-webgl.d.ts) for more advanced usage.

### Handling Context Loss

The browser may drop WebGL contexts for various reasons like OOM or after the system has been suspended. There is an API exposed that fires the `webglcontextlost` event fired on the canvas so embedders can handle it however they wish. An easy, but suboptimal way, to handle this is by disposing of WebglAddon when the event fires:

```ts
const terminal = new Terminal();
const addon = new WebglAddon();
addon.onContextLoss(e => {
  addon.dispose();
});
terminal.loadAddon(addon);
```

Read more about handling WebGL context losses on the [Khronos wiki](https://www.khronos.org/webgl/wiki/HandlingContextLost).

---
_Source: https://npm.io/package/@xterm/addon-webgl · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
