tern
A terminal UI engine for AI coding agents that renders React or SolidJS interfaces through a Rust-native core.
At a Glance
tern core engine and npm packages released under the MIT License, free to use, copy, modify and distribute.
Engagement
Available On
Alternatives
Listed Nov 2026
About tern
tern is an open-source terminal UI engine from EricMoin for building interfaces for AI coding agents, such as streaming transcripts, diffs, prompts, tables, progress indicators and multi-panel workspaces. Developers write declarative UI in React or SolidJS, and a custom renderer drives a Rust scene tree, layout engine, compositor and terminal frontend. It is published on npm under the @tern-tui scope and released under the MIT license.
What It Is
tern is a library for building rich terminal applications, aimed at code-agent front ends. The JavaScript side only describes the scene, while the engine core (scene tree, taffy-based layout, compositor and diff-flush terminal output) runs in Rust and is exposed to Node.js or Deno through a napi addon. Applications create a renderer, mount a React or Solid tree, and receive push-based key, resize, focus, mouse and paste events.
Widgets and Interaction
The widget set has 16 elements, including StreamingText, MarkdownView, DiffView, Input, Textarea, Select, Table, Tabs, Panels, Progress, Spinner, StatusBar, ScrollView, Modal, Box and Text. StreamingText consumes an AsyncIterable of spans with tail-follow auto-scroll. DiffView supports unified or side-by-side diffs with intra-line highlighting, and tables use windowed rows. Markdown code fences get tree-sitter syntax highlighting, and a FocusManager handles Tab traversal, click-to-focus, panel drag-resize, modal focus isolation and bracketed paste.
Setup and Platforms
The packages are @tern-tui/core, @tern-tui/react and @tern-tui/solid, plus the native addon, and they require Node.js 20 or later. Deno 2.x is also supported, and the bundled demos run Deno-first. A real terminal is required because the renderer enters raw mode and the alternate screen, though snapshotFrame and framesEqual allow headless golden-test assertions. The native addon is built for eleven targets across Linux, macOS, Windows, FreeBSD and Android.
Community Discussions
Be the first to start a conversation about tern
Share your experience with tern, ask questions, or help others learn from your insights.
Pricing
Open Source (MIT)
tern core engine and npm packages released under the MIT License, free to use, copy, modify and distribute.
- Rust-native engine with React and SolidJS renderers
- 16 code-agent widget elements
- Streaming text, diffs, tables, and syntax highlighting
- Theme system and golden testing utilities
- MIT License
Capabilities
Key Features
- Rust-native scene tree, layout, compositor and terminal frontend
- React and SolidJS custom renderers with feature parity
- Streaming text with tail-follow auto-scroll
- Bracketed paste routed through a FocusManager
- Tab traversal, click-to-focus, wheel scroll and panel drag-resize
- 16 code-agent widgets including DiffView, MarkdownView, Table and Modal
- Unified and side-by-side diffs with intra-line highlighting
- Tree-sitter syntax highlighting in Markdown code fences
- Theme system with One Dark default
- Golden testing via off-screen frame snapshots
- OSC 52 clipboard support and terminal size introspection
