Back to browse
Go-TUI – a framework for building declarative terminal UIs in Go

Go-TUI – a framework for building declarative terminal UIs in Go

by grindlemire·Mar 4, 2026·2 points·0 comments

AI Analysis

●●●BangerBig BrainWizardry

Templ for TUIs — familiar web syntax compiles to pure Go, no reflection or runtime parsing.

Strengths
  • Declarative .gsx syntax borrowed from templ eliminates bubbletea's boilerplate; compile-time safety means zero runtime overhead.
  • Yoga-based flexbox layout engine with Tailwind class naming lowers barrier for web devs migrating to terminals.
  • Reactive State[T] with Bind() callbacks and double-buffered diffing renderer shows thoughtful architecture for real-world TUI performance.
Weaknesses
  • Terminal UI space already has bubbletea, Bubble Tea, Gocui; positioning against them unclear and adoption risk is real.
  • v0.1.2 status suggests early; no large reference apps yet to prove the abstractions scale.
Target Audience

Go developers building terminal applications

Similar To

Bubbletea · Bubble Tea · Gocui

Post Description

I've been building go-tui (https://go-tui.dev), a terminal UI framework for Go inspired by the templ framework for the web (https://templ.guide/). The syntax should be familiar to templ users and is quite different from other terminal frameworks like bubbletea. Instead of imperative widget manipulation or bubbletea's elm architecture, you write HTML-like syntax and Tailwind-style classes that can intermingle with regular Go code in a new .gsx filetype. Then you compile these files to type-safe Go using `tui generate`.

At runtime there's a flexbox layout engine based on yoga that handles positioning and a double-buffered renderer that diffs output to minimize terminal writes.

Here are some other features in the framework:

- It supports reactive state with State[T]. You change a value and the framework redraws for you. You can also forego reactivity and simply use pure components if you would like.

- You can render out a single frame to the terminal scrollback if you don't care about UIs and just want to place a box, table, or other styled component into your stdout. It's super handy and avoids the headache of dealing with the ansi escape sequences directly.

- It supports an inline mode that lets you embed an interactive widget in your shell session instead of taking over the full screen. With it you can build things like custom streaming chat interfaces directly in the terminal.

- I built full editor support for the new filetype. I published a VS Code and Open-VSX extension with completion, hover, and go-to-definition. Just search for "go-tui" in the marketplace to find them. The repo also includes a tree-sitter grammar for Neovim/Helix, and an LSP that proxies Go features through gopls so the files are easy to work with.

There are roughly 20 examples in the repo covering everything from basic components to a dashboard with live metrics and sparklines. I also built an example wrapper for claude code if you wanted to build your own AI chat interface.

Docs & guides: https://go-tui.dev

Repo: https://github.com/grindlemire/go-tui

I'd love feedback on the project!

Similar Projects