https://github.com/sst/opentui
https://github.com/sst/opentui
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/sst/opentui
- Owner: sst
- Created: 2025-07-21T09:35:54.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2025-08-08T14:30:27.000Z (about 2 months ago)
- Last Synced: 2025-08-08T16:24:07.072Z (about 2 months ago)
- Language: TypeScript
- Size: 1.78 MB
- Stars: 1,698
- Watchers: 14
- Forks: 43
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# OpenTUI
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](https://opencode.ai) and [terminaldotshop](https://terminal.shop).## Build
```bash
bun build:prod
```This creates platform-specific libraries in `src/zig/lib/` that are automatically loaded by the TypeScript layer.
## Examples
```bash
bun run src/examples/index.ts
```## CLI Renderer
### Renderables
Renderables are hierarchical objects that can be positioned and rendered to buffers:
```typescript
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)
```