Skip to content
forked from anomalyco/opentui

OpenTUI is a library for building terminal user interfaces (TUIs)

License

Notifications You must be signed in to change notification settings

thomgit9/opentui

 
 

Repository files navigation

Documented with Setinstone.io NPM @opentui/core License: MIT

OpenTUI

Presentation

OpenTUI is an open-source TypeScript library for building terminal user interfaces (TUIs).
It provides a modular and high-performance foundation for creating interactive CLI-based UI components and applications.
OpenTUI aims to serve as the foundational framework for both opencode and terminaldotshop.

This monorepo includes multiple bindings and reconcilers for various frameworks:

Latest update: feat(core): allow configuring cursor style (commit 5e41a03) on 2025‑11‑05 by Adictya.

License: MIT

Contributors include: kommander, msmps, Adictya, fezproof, remorses, bhushan6, KurtGokhan, and others.


Installation

Requirement: You must have Zig installed on your system to build the packages.

Using Bun (recommended)

bun install @opentui/core

Quick Start with Template

You can scaffold a new TUI app using create-tui:

bun create tui

Usage

Running Core Examples (from repo root)

bun install
cd packages/core
bun run src/examples/index.ts

Local Development Linking

Use the link-opentui-dev.sh script to test OpenTUI changes in another project without publishing.

Basic usage:

./scripts/link-opentui-dev.sh /path/to/your/project

Options:

  • --react — Link @opentui/react
  • --solid — Link @opentui/solid and solid-js
  • --dist — Link dist directories instead of source
  • --copy — Copy dist output instead of creating symlinks (requires --dist)

Examples:

./scripts/link-opentui-dev.sh /project/path              # Core only
./scripts/link-opentui-dev.sh /project/path --solid      # Link core + solid
./scripts/link-opentui-dev.sh /project/path --react --dist
./scripts/link-opentui-dev.sh /project/path --dist --copy

Notes:

  • Target project must have node_modules initialized.
  • Source mode enables hot-reloading.
  • Use --dist when testing build artifacts.
  • Use --copy for symlink-limited environments (e.g. Docker, Windows).

Main Functions and Classes

Name File Description Inputs Outputs
Renderable packages/core/src/Renderable.ts Base class representing a renderable terminal element. Props (dimensions, content) Renderable instance
CliRenderer packages/core/src/renderer.ts Main TUI renderer managing the render lifecycle in terminal. Render tree, target stream Renders UI in terminal
Timeline packages/core/src/animation/Timeline.ts Handles animation sequencing and synchronized transitions. Keyframes, duration Animation control object
TextBuffer packages/core/src/text-buffer.ts Manages text input and display buffer. String data Buffer object
EditorView packages/core/src/editor-view.ts Provides a full TUI editor abstraction for text editing. Input events, buffer Updated editable content view
KeyHandler packages/core/src/KeyHandler.ts Maps and handles keyboard input events. Key events Action dispatch
Yoga packages/core/src/index.ts Layout engine interface for flexbox-style terminal elements. Layout nodes Computed layout
AppContext packages/react/src/components/app.tsx Context managing CLI renderer and keyboard handler in React. React context inputs Context provider
useAppContext() packages/react/src/components/app.tsx React hook exposing the OpenTUI app context. None { keyHandler, renderer }
render() packages/vue/src/renderer.ts Vue-specific terminal rendering entry point. Vue component Renders TUI app in console
extend() packages/vue/src/extend.ts Extends the Vue TUI renderer with custom renderables. Custom components Updated renderer registry
opentui.go packages/go/opentui.go Go bindings entry point for OpenTUI core. Go struct definitions Exposed TUI bindings

⛰️ Documented With SetinStone.io

Focus on the only task that matters: building your codebase! With every developer push, Set In Stone’s Mirror Documentation Agent updates your README.md via a pull request — ready for you to review, edit, and approve.

Book a demo

About

OpenTUI is a library for building terminal user interfaces (TUIs)

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 61.6%
  • Zig 35.5%
  • Go 1.6%
  • Tree-sitter Query 0.4%
  • Shell 0.3%
  • Vue 0.2%
  • Other 0.4%