On March 31, 2026, Claude Code's full TypeScript source was accidentally exposed via npm source maps. Like many developers, I started reading through it — and what I found surprised me.
The terminal UI layer wasn't a quick hack. It was a production-grade rendering engine: a custom React reconciler, a pure TypeScript Yoga layout port, a complete ANSI/CSI/DEC/ESC/OSC parser stack, and dozens of polished UI components. All battle-tested across 500K+ daily sessions.
So I extracted the architecture, rewrote the components from scratch, and turned it into an open-source toolkit.
What is claude-code-kit?
A terminal UI toolkit with 3 packages:
- @claude-code-kit/shared — Yoga layout engine (pure TypeScript, no native bindings)
- @claude-code-kit/ink-renderer — Terminal rendering engine (React reconciler + Flexbox + keyboard/mouse events)
- @claude-code-kit/ui — 25+ UI components (REPL, Select, PromptInput, Spinner, and more)
Quick Start
pnpm add @claude-code-kit/ui react
import { render, Box, Text } from '@claude-code-kit/ink-renderer'
import { REPL, type Message } from '@claude-code-kit/ui'
import { useState } from 'react'
function App() {
const [messages, setMessages] = useState<Message[]>([])
return (
<REPL
messages={messages}
onSubmit={async (text) => {
setMessages(prev => [...prev,
{ id: Date.now().toString(), role: 'user', content: text },
{ id: (Date.now()+1).toString(), role: 'assistant', content: `You said: ${text}` }
])
}}
commands={[
{ name: 'clear', description: 'Clear history', onExecute: () => setMessages([]) },
]}
placeholder="Type a message..."
/>
)
}
await render(<App />)
That's a complete interactive REPL — message history, streaming text, slash commands, keyboard shortcuts — in 20 lines.
Components
Here's what you get:
| Component | What it does |
|---|---|
| REPL | Complete chat interface with message history, streaming, slash commands |
| Select | List picker with keyboard navigation (arrows, j/k, number keys) |
| MultiSelect | Multi-item picker with toggle |
| PromptInput | Text input with cursor, history, command autocomplete |
| MessageList | Chat messages with user/assistant/system styling |
| Spinner | Animated loading with verb rotation and elapsed time |
| ProgressBar | Visual progress indicator |
| StatusLine | Bottom status bar with segments |
| Divider | Horizontal rule with optional title |
| StreamingText | Character-by-character text reveal |
| Markdown | Terminal markdown rendering |
Plus a design system (Dialog, Tabs, FuzzyPicker, ThemeProvider) and a command registration framework.
What's different from Ink?
Ink is great for simple CLIs. claude-code-kit builds on the same React model but adds:
- Pure TypeScript Yoga layout — no native bindings, no WASM, works everywhere
- Extended terminal I/O — full ANSI/CSI/DEC/ESC/OSC parser, not just basic escape codes
- Higher-level components — REPL, Select with descriptions, streaming text, command framework
- AI agent patterns — designed for the use case of building interactive AI tools
If you're building an AI coding assistant, trading terminal, or data dashboard in the terminal, this saves you from reinventing what Claude Code already solved.
What I learned from the source
A few things stood out:
-
They use React Compiler — all components were compiled with it, which made extraction harder (the output is
_c(81)style memoization caches, not readable JSX) - The Yoga layout is a full TS rewrite — not a binding to the C++ library. ~2700 lines of pure TypeScript
-
Dead code elimination via feature flags —
bun:bundle'sfeature()function gates entire subsystems at build time - The keybinding system is Claude Code's best-kept secret — chord sequences, context-aware bindings, user-configurable shortcuts
Honest disclaimer
The rendering engine (@claude-code-kit/ink-renderer) is extracted from Claude Code's source. All UI components in @claude-code-kit/ui are clean rewrites — they are not copied from Claude Code. I wrote them from scratch, using Claude Code's visual patterns as reference.
This is an independent community project. Not affiliated with Anthropic.
Links
- GitHub: github.com/Minnzen/claude-code-kit
- npm: @claude-code-kit/ui
- Docs: Component documentation
If you're building terminal tools, give it a try and let me know what you think.

Top comments (0)