explaingit

jroimartin/gocui

10,558GoAudience · developerComplexity · 2/5Setup · easy

TLDR

Gocui is a minimal Go library for building text-based interfaces that run inside a terminal, letting you create panels, input areas, and keyboard shortcuts in a terminal app the way tools like htop or vim do.

Mindmap

mindmap
  root((gocui))
    What it does
      Terminal UI
      Text-based panels
      Keyboard bindings
    Features
      View overlapping
      Mouse support
      Colored text
    Use Cases
      CLI dashboards
      Input forms
      Dev tools
    Setup
      go get command
      Go package docs
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Build a terminal dashboard with multiple panels that display live data using familiar Go reader and writer patterns

USE CASE 2

Add a structured terminal UI to a Go CLI tool so users can navigate views with keyboard shortcuts

USE CASE 3

Create a text-based app with overlapping panels, mouse support, and colored text that runs anywhere in the terminal

Tech stack

Go

Getting it running

Difficulty · easy Time to first run · 30min

In plain English

Gocui is a Go library for building text-based user interfaces that run inside a terminal window. Instead of building a graphical desktop application, you use gocui to create panels, input areas, and layouts that display as text in a terminal, similar to tools like htop or vim that have their own visual layout inside the command line. The library is designed to be minimal. You define views, which are the individual rectangular panes that make up your interface, and each view works like a standard Go reader and writer, so you can send text to it and read input from it using familiar patterns. Views can overlap each other, the layout can be changed while the program is running, and the library handles concurrent updates safely. Other features listed in the README include mouse support, colored text, keyboard bindings that can apply either to the whole application or to a specific view, and an edition mode that can be customized. The library includes example programs in its repository showing common patterns, and full documentation is available on the Go package documentation website. Installation is a single go get command, as it follows the standard Go package workflow. The README includes a short working example that creates a GUI with one view displaying "Hello world" and a Ctrl+C keybinding to quit. Gocui is aimed at Go developers who want to add a structured terminal interface to their programs without pulling in a large dependency. The README is brief, and the project does not describe any limitations or known issues beyond what is implied by the feature list.

Copy-paste prompts

Prompt 1
Show me how to build a terminal UI with gocui that has two side-by-side panels, one for a list of items and one for a detail view.
Prompt 2
Write a gocui app in Go that has an input box at the bottom and a scrollable output panel above it, with Enter to submit text.
Prompt 3
How do I add mouse click support and per-view keyboard bindings to a gocui terminal application?
Prompt 4
Create a gocui dashboard that reads from a Go channel and updates a panel with new lines as they arrive without blocking the main thread.
Open on GitHub → Explain another repo

← jroimartin on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.