Library · TUI Framework

Boba

A C library for building terminal user interfaces with the Elm Architecture — runtime, styles, and components in one package.

#elm-architecture #library #tui #c #terminal

What is Boba?

Boba is a C library for building terminal user interfaces with the Elm Architecture — runtime, styles, and components in one package. The runtime owns the event loop and reconciles each frame against the terminal state it tracks; styles are value-typed and compose without mutation; components are plain structs with matching create and free functions. It has zero external dependencies — libc only.

Elm Architecture (Model-View-Update)

Components implement TuiComponent with init(), update(), view(), and free(). view() returns a TuiView (content + cursor + terminal-mode flags) that the runtime diffs against tracked state. Styles are value-typed (TuiStyle); setters return new values rather than mutating.

Two runtime modes: tui_runtime_run() (owns the event loop) or manual process_input() / flush().

Features

  • Elm Architecture runtime in pure C
  • Value-typed style system
  • Components: textinput, viewport, statusbar, textview
  • Pluggable event loop via TuiRuntimeConfig callbacks
  • tmux-driven end-to-end tests (auto-included when tmux is detected)
  • Zero external dependencies — libc only
  • -Werror enforced

Build & install

Boba is a zero-dependency library:

git clone https://github.com/chestso/boba
cd boba
./autogen.sh
mkdir -p build && cd build
../configure --prefix=$HOME/.local
make -j"$(nproc)"
make install

Consumed via pkg-config by ditty's TUI REPL, mudlark, and nevermore.