OpenTUI is a TypeScript library for building terminal user interfaces (TUIs). It is currently in development and is not ready for production use. It will be the foundational TUI framework for both opencode and terminaldotshop.
bun build:prod
This creates platform-specific libraries in src/zig/lib/
that are automatically loaded by the TypeScript layer.
bun run src/examples/index.ts
Renderables are hierarchical objects that can be positioned and rendered to buffers:
import { Renderable } from "@opentui/core"
class MyRenderable extends Renderable {
protected renderSelf(buffer: OptimizedBuffer): void {
buffer.drawText("Custom content", this.x, this.y, RGBA.fromValues(1, 1, 1, 1))
}
}
const obj = new MyRenderable("my-obj", { x: 10, y: 5, zIndex: 1 })
renderer.root.add(obj)