An addon for xterm.js that enables fitting the terminal's dimensions to a containing element. This addon requires xterm.js v4+.
npm install --save @xterm/addon-fit
import { Terminal } from '@xterm/xterm';
import { FitAddon } from '@xterm/addon-fit';
const terminal = new Terminal();
const fitAddon = new FitAddon();
terminal.loadAddon(fitAddon);
terminal.open(containerElement);
fitAddon.fit();
See the full API for more advanced usage.