Getting started
OpenTUI is a native terminal UI core written in Zig with TypeScript bindings.
It renders a component tree, lays it out with Flexbox, handles terminal input, and updates the cells that changed. OpenTUIās TypeScript packages call the Zig library through its native interface. OpenTUI powers OpenCode in production.
Start with the quickstart#
Build your first app in the quickstart. In the quickstart, you create a project from an empty directory, compose a small interface, handle keyboard input, and run it in your terminal.
The quickstart uses @opentui/core directly to teach the renderer, component tree, input, and layout model once. You
do not need to choose a framework before you complete it.
Check Runtime and platform support before you use Node.js, cross-compile, or deploy to another target.
Choose a framework#
@opentui/coreuses imperative renderables and events directly.@opentui/reactuses React components, hooks, and state.@opentui/soliduses Solid components, signals, and effects.
If you use Core, read Renderables after the quickstart.
Find a topic#
- Components compares component availability across Core, React, and Solid.
- Renderer covers terminal setup, the root, scheduling, and central events.
- Layout covers Yoga-based sizing and positioning.
- Interaction, focus, and selection explains shared pointer and focus behavior.
- Testing renders apps in memory for assertions and snapshots.
- Package entry points lists supported import paths.
- Lifecycle and cleanup owns terminal restoration and resource release.
- Native rendering explains the scene model and native C and Zig interfaces.
Explore the examples#
Run the OpenTUI example browser without cloning the repository. Release executables support macOS x64 and arm64, Linux x64, and Windows x64. On those targets, including x64 WSL and Git Bash:
curl -fsSL https://raw.githubusercontent.com/anomalyco/opentui/main/packages/examples/install.sh | shOn Windows, download the latest release from GitHub Releases.
Give an agent the docs#
OpenTUI includes a skill that teaches AI coding assistants its APIs and patterns. It holds these docs and the release
notes. Install the skill of the latest release with npx skills:
npx skills add https://opentui.com --skill opentuiAdd -g to install the skill globally for every project. OpenCode uses the same install command. npx skills update
moves the skill to the newest release. For the main branch, install from https://opentui.com/docs/next instead.
A skill installed with npx skills add anomalyco/opentui follows the main branch. Run the command above to switch it
to releases.
Versions#
These docs describe one release. The site header names it, and next beside it opens the docs of the main branch,
which include unreleased changes. Releases lists what changed in each release, and the API reference
names the release that added each export. Above its previous and next links, a page lists its changes in recent
releases.