OpenTUI

A native terminal UI core written in Zig with TypeScript bindings. The Zig core handles rendering, text storage, and Unicode processing via a C ABI. TypeScript provides the component system, Yoga flexbox layout, and framework integrations (SolidJS and React). Powers OpenCode in production.

Overview

  • Repo: anomalyco/opentui
  • Install: bun add @opentui/core
  • Runtime: Bun (>=1.3.0). Node.js and Deno support in progress.
  • Build requirement: Zig (for native core development only; prebuilt binaries available)
  • Version: 0.1.96
  • Packages: @opentui/core, @opentui/solid, @opentui/react

Contents

Concepts

  • Architecture - How the pieces fit together: Zig core, TypeScript components, Yoga layout, framework reconcilers
  • Component Model - Renderables, constructs, the renderable tree, and framework integration

Quickstart

  • Hello World - Get a TUI app running in 3 minutes: imperative, Solid, and React
  • Components Guide - Using built-in components: Box, Text, Input, Select, ScrollBox, Code, and more

Deep Dives

  • Native Core - The Zig rendering engine: double buffering, ropes, SIMD UTF-8, hit testing
  • Testing - Headless test renderer, mock input, frame capture

Notes

  • Gotchas - Common pitfalls and terminal compatibility

Resources