Files
fressh/packages/react-native-xtermjs-webview
..
2025-09-21 20:58:44 -04:00
2025-10-04 21:03:01 -04:00
2025-09-17 17:22:50 -04:00
2025-10-07 00:21:46 -04:00
2025-09-18 02:27:05 -04:00
2025-10-04 21:03:01 -04:00
2025-09-20 04:08:23 -04:00
2025-10-06 23:31:28 -04:00
2025-09-17 00:33:36 -04:00
2025-10-07 00:21:46 -04:00
2025-09-17 17:22:50 -04:00
2025-09-17 00:33:36 -04:00
2025-09-17 17:22:50 -04:00
2025-10-06 20:12:50 -04:00
2025-09-19 23:41:17 -04:00
2025-10-04 21:03:01 -04:00
2025-09-21 20:58:44 -04:00

@fressh/react-native-xtermjs-webview

React Native WebView that embeds xterm.js with sensible defaults and a bridge for input and output.

npm version

Install

pnpm add @fressh/react-native-xtermjs-webview react-native-webview

Peer dependencies: react, react-dom (for web), react-native-webview.

Usage

See apps/mobile in this monorepo for a complete example. Basic usage:

import React, { useRef } from 'react';
import {
	XtermJsWebView,
	type XtermWebViewHandle,
} from '@fressh/react-native-xtermjs-webview';

export function Terminal() {
	const termRef = useRef<XtermWebViewHandle | null>(null);
	return (
		<XtermJsWebView
			ref={termRef}
			onInitialized={() =>
				termRef.current?.write(new TextEncoder().encode('hello'))
			}
			onData={(input) => console.log('user input:', input)}
		/>
	);
}

Props

  • webViewOptions: subset of react-native-webview props (sane defaults applied)
  • xtermOptions: partial @xterm/xterm options (theme, font, scrollback, etc.)
  • onInitialized: called when the terminal is ready
  • onData(str): emits user keystrokes
  • size: { cols, rows } to set terminal size
  • autoFit: auto-fit after important changes (default: true)

Ref API

  • write(bytes), writeMany([bytes...]), flush()
  • clear(), focus(), fit(), resize({ cols, rows })

Publishing contents

This package intentionally publishes both src/ and built dist/ artifacts for transparency and debugging.