Ink

React for CLIs — build and test interactive command-line apps using declarative, Flexbox-based components instead of manual stdout writes.

Library
npm
v7.1.1
39,967 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
89 /100 Excellent
Development Activity 96
Maintenance 96
Community 64
Maturity 60
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
85 /100 Excellent
Architecture 90
Code Quality 88
Innovation 88
Learning Curve 75

Ink brings React’s component model to the terminal. It ships a custom React reconciler (built on react-reconciler) that renders JSX to a Yoga-powered Flexbox layout engine instead of the DOM, so <Box> and <Text> components with flexDirection, padding, borderStyle, and other CSS-like props lay out real terminal output. Because it’s just React, existing hooks, state, effects, and context all work unmodified, and the same testing patterns used for browser React components carry over to CLI output.

Beyond static rendering, Ink provides terminal-specific primitives that a plain string-building CLI would otherwise hand-roll: useInput/usePaste for keyboard and paste handling, useFocus/useFocusManager for focus traversal between interactive elements, Static for permanently-committed output like logs, and utilities for measuring rendered element dimensions. It underpins some of the most widely used AI and developer-tooling CLIs in the ecosystem, including Claude Code, Gemini CLI, and GitHub Copilot CLI.

What You Get

  • A full React renderer (custom reconciler + Yoga layout engine) so JSX, hooks, state, and context work exactly as they do in browser React, just targeting stdout
  • Box and Text primitives with Flexbox props (flexDirection, justifyContent, padding, borderStyle, gap) for laying out terminal UI declaratively
  • Input handling hooks — useInput for keypresses (including Kitty keyboard protocol support) and usePaste for bracketed paste — so interactive CLIs don’t need to parse raw stdin themselves
  • Focus management via useFocus/useFocusManager for building forms and menus with tab-style navigation between components
  • A Static component for output that should be committed permanently to the terminal scrollback (e.g. completed task logs) separate from the actively re-rendered UI
  • renderToString and snapshot-friendly rendering for testing CLI output the same way React components are tested in the browser

Common Use Cases

  • Building agentic coding CLIs with live-updating status panes, streaming output, and interactive prompts (the pattern used by Claude Code and Gemini CLI)
  • Interactive setup wizards and scaffolding tools that need multi-step forms, selection lists, and validation feedback in the terminal
  • Long-running build/deploy CLIs that show progress bars, spinners, and structured multi-panel status while a task executes
  • Dashboards and monitoring TUIs that need Flexbox layout and periodic re-renders driven by React state rather than manual redraw logic

Under The Hood

Architecture Ink’s core is a custom React reconciler (src/reconciler.ts, built on react-reconciler) paired with a parallel DOM-like tree (src/dom.ts) whose nodes carry Yoga layout nodes for Flexbox computation. render.ts wires a React root to an Ink instance (ink.tsx) that owns the output stream, a Yoga root node, and a log-update-style terminal writer (log-update.ts, write-synchronized.ts) that diffs and repaints only what changed rather than clearing and redrawing the whole screen. Rendering the DOM tree to terminal output happens in render-node-to-output.ts and renderer.ts, which walk the Yoga-computed layout and paint borders, backgrounds, and text into an output buffer. Because layout, diffing, and painting are cleanly separated stages, swapping the terminal writer or extending layout support doesn’t require touching the reconciler itself.

Tech Stack Written entirely in TypeScript (ESM-only, Node >=22), Ink depends on react-reconciler and scheduler to plug into React’s concurrent rendering, yoga-layout for Flexbox computation, and a cluster of small terminal-string utilities (ansi-escapes, cli-truncate, slice-ansi, wrap-ansi, string-width, chalk) for ANSI-aware text measurement and styling that a naive character-count approach would get wrong with wide/emoji characters. react and react-devtools-core are peer dependencies, keeping Ink decoupled from a specific React version within its supported range. The build is plain tsc compiling to build/, with no bundler needed since it’s a Node-only library.

Code Quality Tests run under ava (serial mode, TypeScript via tsx) with a large suite covering components, hooks, focus management, keyboard parsing, and terminal rendering edge cases, plus node-pty for exercising real pseudo-terminal behavior. Linting is enforced via xo (an ESLint preset) with a project-specific flat config, formatting via prettier, and tsc --noEmit for a separate typecheck step — all three gate npm test and run in CI (GitHub Actions) across two Node major versions. Naming and file structure follow a consistent one-concept-per-file convention across src/components and src/hooks.

What Makes It Unique Ink’s distinguishing choice is implementing a genuine React reconciler for the terminal rather than a template or virtual-DOM-diffing approach layered on top of string output — this is the same mechanism React Native and React-Three-Fiber use to target non-DOM surfaces, applied to stdout. Combined with Yoga for real Flexbox layout (not an approximation), it lets terminal UIs use the same mental model, hooks, and component composition patterns as web React, which is why large, actively maintained agentic CLIs adopted it as their rendering layer instead of writing bespoke terminal UI code.

Used by 18 apps in this directory

TypeScript
99%
Other

byterover-cli

AI Agents · AI Code Assistants · AI Memory

4,966

A portable memory layer for AI coding agents — curate structured project knowledge into a version-controlled context tree that syncs across tools, machines, and teammates.

View details
50
Repo Health
83
Technical
70
Dependency
Built with
TypeScript 99%
Updated 3 months ago
TypeScript
96%
Other

Cal.diy

Scheduling

48,697

The 100% MIT-licensed, community-driven scheduling platform — self-host your own booking infrastructure with no enterprise strings attached.

View details
91
Repo Health
86
Technical
65
Dependency
Built with
TypeScript 96%
Updated 1 weeks ago
TypeScript
84%
Apache 2.0

Continue

AI Code Assistants · AI Development · Automation

36,049

Open-source coding agent for VS Code, JetBrains, and CLI with support for 30+ LLM providers.

View details
73
Repo Health
88
Technical
62
Dependency
Built with
TypeScript 84%
Updated 6 days ago
TypeScript
94%
Apache 2.0

flue

AI Agents · Developer Tools

8,383

Build autonomous AI agents and powerful workflows with a programmable TypeScript harness that gives any model sessions, tools, sandboxes, and durable execution.

View details
80
Repo Health
82
Technical
70
Dependency
Built with
TypeScript 94%
Updated 1 weeks ago
TypeScript
96%
MIT

HyperDX

Analytics · Developer Tools · Monitoring

9,916

Open source observability platform that unifies logs, traces, metrics, and session replays on ClickHouse — now the core of ClickStack.

View details
87
Repo Health
83
Technical
65
Dependency
Built with
TypeScript 96%
Updated 1 weeks ago
TypeScript
98%
Other

Kibana

Analytics · Monitoring

21,301

Your open source window into the Elastic Stack — query, visualize, and act on data stored in Elasticsearch with real-time dashboards, AI-assisted search, and automated alerting.

View details
98
Repo Health
87
Technical
63
Dependency
Built with
TypeScript 98%
Updated 5 days ago
TypeScript
84%
Apache 2.0

ktx

AI Development · Analytics · Data Engineering

1,603

ktx builds a self-improving context layer over your data warehouse so AI agents like Claude Code and Codex query it with approved metric definitions instead of reinventing SQL logic from scratch.

View details
66
Repo Health
85
Technical
72
Dependency
Built with
TypeScript 84%
Updated 3 weeks ago
TypeScript
78%
LGPL 3.0

Latitude

AI Agents · Monitoring

4,686

Open-source AI agent monitoring that catches what will break next before your users do.

View details
86
Repo Health
88
Technical
67
Dependency
Built with
TypeScript 78%
Rust 11%
Python 11%
Updated 1 weeks ago
TypeScript
98%
Apache 2.0

letta-code

AI Assistants · AI Code Assistants

3,446

A memory-first coding agent harness that learns from experience, maintains identity across models, and works across Claude, GPT, Gemini, and dozens more LLMs.

View details
85
Repo Health
84
Technical
74
Dependency
Built with
TypeScript 98%
Updated 5 days ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers