‹ Back to Home

TerminUI: A Fast, Functional TypeScript Library for Building Beautiful Terminal User Interfaces

TerminUI is a brand-new TypeScript library for building terminal user interfaces with a purely functional architecture. With zero classes, double-buffered rendering, 10+ built-in widgets, JSX support, and TypeScript strict mode, TerminUI brings React-like developer experience to the terminal.

Keerthika 4 min read 613
Follow on Google
Updated 7 months ago
Programming TerminUI: A Fast, Functional TypeScript Library for Building Beautiful Terminal User Interfaces 4 min left Follow on Google
TerminUI: A Fast, Functional TypeScript Library for Building Beautiful Terminal User Interfaces

TamilTech AI summary

TerminUI is a new TypeScript library by Ahmad Awais that lets you build terminal user interfaces with a purely functional style—plain objects in and out, no classes or hidden state—and it already has 225+ GitHub stars under Apache 2.0. It stands out because it uses double-buffered diff rendering so only changed cells hit the screen, plus a constraint-based layout system and 10+ built-in widgets like lists, tables, gauges, and charts. You also get React-like JSX helpers without a virtual DOM, full strict TypeScript safety, and rich styling with ANSI, 256-color, and true RGB options. That matters if you are building CLI dashboards, AI agent interfaces, or DevOps monitors and want smoother updates than older libraries like Ink or Blessed. Just know it is still early at v0.3.1, so the API may change, and input handling plus a full event system are not there yet—install with pnpm or npm and drive it through a simple backend, terminal, and draw loop.

AI-assisted summary, checked by the TamilTech editorial team.

0:00
0:00
🔒 Listen is for subscribers. Subscribe

TerminUI — React-Like DX Meets the Terminal

If you've ever tried building a terminal UI in Node.js, you know the pain. Most TUI libraries are either too low-level (curses-style) or too opinionated (Ink/React model). Enter TerminUI — a brand-new TypeScript library by Ahmad Awais that takes a radically different approach: purely functional, zero classes, no mutation. Think of it as what would happen if Ratatui (Rust's popular TUI library) and React had a TypeScript baby.

Released under the Apache 2.0 license, TerminUI (currently at v0.3.1) has already garnered 225+ stars on GitHub and is rapidly gaining traction among developers building CLI tools, dashboards, and AI agent interfaces.

Why Another TUI Library?

The terminal UI space in the JavaScript/TypeScript ecosystem has been dominated by a few players:

LibraryArchitectureLanguageRendering
InkReact-based (classes/hooks)TypeScriptFull re-render
BlessedObject-oriented (class hierarchy)JavaScriptWidget tree
terminal-kitImperative APIJavaScriptDirect write
TerminUIPurely functionalTypeScriptDouble-buffered diff

TerminUI's core philosophy is simple: plain objects in, plain objects out. Every widget is just a function that takes an area and a buffer, and renders cells into it. No this, no class hierarchies, no hidden state.

Core Architecture

TerminUI follows a clean data flow pipeline:

Backend → Terminal → Frame → Buffer → Cells
↑ Widgets (pure render functions)
↑ Layout (constraint solver)

Double-Buffered Rendering

This is where TerminUI really shines. Instead of re-writing the entire terminal every frame (like most TUI libraries), it maintains two buffers:

  • Previous frame buffer — What's currently displayed
  • Current frame buffer — What needs to be displayed

Between frames, only changed cells are flushed to the terminal. This means buttery-smooth updates even in complex dashboards with multiple widgets. If you've ever used Ratatui in Rust, you'll recognize this pattern — TerminUI brings it to TypeScript for the first time.

The Layout System

TerminUI's constraint-based layout system is one of its most powerful features. You can split any rectangle using six constraint types:

ConstraintFunctionExample
LengthlengthConstraint(n)Exactly 10 cells wide
PercentagepercentageConstraint(n)50% of available space
RatioratioConstraint(num, den)1/3 proportion
MinminConstraint(n)At least 5 cells
MaxmaxConstraint(n)At most 20 cells
FillfillConstraint(weight)Fill remaining space

Layouts support both vertical (default) and horizontal directions, and constraints can be nested for complex layouts.

Built-in Widgets

TerminUI ships with 10+ production-ready widgets:

  • Block — Container with optional borders and titles
  • Paragraph — Text rendering with word-wrap and alignment
  • List — Scrollable lists with selection highlighting
  • Table — Data tables with column constraints
  • Gauge — Progress bars with customizable styles
  • Tabs — Tab navigation widget
  • Sparkline — Inline mini-charts for data visualization
  • BarChart — Horizontal/vertical bar charts
  • Scrollbar — Scrollbar indicators
  • Clear — Area clearing widget

The Style System

TerminUI supports a comprehensive styling system:

Colors

  • 16 ANSI colors — Black, Red, Green, Yellow, Blue, Magenta, Cyan, White, and their bright variants
  • 256-color indexed — indexedColor(n) for the extended palette
  • 24-bit RGB — rgbColor(r, g, b) for true color support

Modifiers

BOLD, DIM, ITALIC, UNDERLINED, SLOW_BLINK, RAPID_BLINK, REVERSED, HIDDEN, CROSSED_OUT, DOUBLE_UNDERLINED, OVERLINED — all composable via createStyle(), styleFg(), styleBg(), and styleAddModifier().

JSX Support — React-Like Syntax Without React

Perhaps the most developer-friendly feature is TerminUI's JSX API. It provides React-like components without a virtual DOM:

  • VStack / Column — Vertical layout
  • HStack / Row — Horizontal layout
  • Box / Panel — Container with borders
  • Text / Label — Text rendering
  • List, Table, Gauge, LineGauge, Tabs, Sparkline, BarChart, Scrollbar, Clear, Cursor

Common props include gap for spacing, p/px/py for padding, border and title for containers, and fg/bg/bold for styling.

TypeScript Strict Mode

TerminUI is written with the strictest TypeScript configuration:

  • strict: true
  • noUncheckedIndexedAccess: true
  • Zero any types in the entire codebase

This means you get full type safety for all widgets, layouts, and styles — IDE autocompletion works perfectly.

Use Cases for Indian Developers

  • CLI dashboards — Build monitoring tools for your servers with real-time charts and gauges
  • AI agent interfaces — Create terminal UIs for LLM-based agents (the article "From Browser to Terminal: How TypeScript Conquered the AI Agent TUI" on Medium highlights this trend)
  • DevOps tools — Status monitors, deployment dashboards, log viewers
  • Interview prep — Building CLI tools is a great portfolio project for job seekers

Getting Started

Install via your preferred package manager:

pnpm add terminui (or npm install terminui)

The basic pattern uses a backend, terminal, and draw loop:

  1. Create a backend (test backend for development, crossterm backend for production)
  2. Create a terminal with the backend
  3. Call terminalDraw(terminal, renderFn) in your main loop
  4. Inside the render function, create layouts and render widgets

Limitations

  • Early stage (v0.3.1) — API may change in breaking ways
  • No input handling — Currently focused on rendering; input handling is planned
  • Small community — 225 stars, 10 forks; ecosystem is still forming
  • No event system — Unlike Ink/React, there's no built-in state management or event loop

Despite these limitations, TerminUI's functional-first approach and TypeScript-native design make it a compelling choice for developers who want the ergonomics of React without the complexity of a full UI framework.

Frequently asked questions

4

What is TerminUI and how is it different from Ink?

TerminUI is a TypeScript library for building terminal user interfaces with a purely functional architecture — zero classes, no mutation, plain objects in and out. Unlike Ink which uses React's component model with hooks and state, TerminUI treats every widget as a pure function and uses double-buffered rendering for performance.

Does TerminUI support JSX?

Yes, TerminUI provides a React-like JSX API without a virtual DOM. Components include VStack, HStack, Box, Text, List, Table, Gauge, Tabs, Sparkline, BarChart, and more. You can use familiar props like gap, padding (p/px/py), border, and styling (fg/bg/bold).

What widgets does TerminUI include?

TerminUI ships with 10+ built-in widgets: Block (containers), Paragraph (text with word-wrap), List (scrollable), Table (with column constraints), Gauge (progress bars), Tabs (navigation), Sparkline (mini-charts), BarChart, Scrollbar, and Clear. All widgets are pure functions.

Is TerminUI production-ready?

TerminUI is currently at v0.3.1 and is still early stage. The API may change, input handling is not yet implemented, and the community is small (225 stars, 10 forks). It's suitable for experimental projects and prototyping but may need more maturity for production CLI tools.

Get tomorrow’s tech news on WhatsApp

One short update a day, free. Follow the TamilTech channel.

What do you think?

people reacted

Keerthika

TamilTech editorial team · 3,761 articles

Keerthika is an editor at TamilTech, the Tamil and English technology publication founded by Praveen Kumar S. She covers AI, smartphones, gadgets, EVs, startups and cybersecurity i...

More from Keerthika

Ask TamilTech on WhatsApp

Tech doubt? Ask in Tamil or English — our WhatsApp assistant answers from TamilTech articles in seconds.

Related stories

Comments (0)

| Supports **bold**, *italic*, `code`

Be the first to comment!

Next story The 30 Linux commands you will actually type at work
TamilTech

TamilTech

Install app for faster access

Earn XP 🏆
WhatsApp
Notifications