Skip to content

Introduction

What is TUI.zig?

TUI.zig is a modern, feature-rich Terminal User Interface (TUI) library for the Zig programming language. It provides everything you need to build beautiful, interactive terminal applications with a simple, intuitive API.

Philosophy

TUI.zig is designed with these principles:

  1. Simple API - As easy to use as Python, but with Zig's performance
  2. Zero Dependencies - Pure Zig, no external C libraries
  3. Cross-Platform - Works on Linux, Windows, macOS, and BSD
  4. High Performance - Diff-based rendering, double buffering
  5. Feature Complete - All the widgets and features you need built-in

Features at a Glance

🎨 Rendering

  • True Color (24-bit RGB) - Full color spectrum
  • 256 Color Mode - For older terminals
  • 16 ANSI Colors - Universal fallback
  • Double Buffering - No flicker
  • Diff-Based Updates - Only render what changed
  • Unicode Support - Emoji, CJK, grapheme clusters

🧩 Widgets

TUI.zig includes 14+ built-in widgets:

WidgetDescription
TextStyled text with alignment
ButtonClickable with hover states
Input FieldSingle-line text input
Text AreaMulti-line editor
CheckboxToggle checkboxes
Radio ButtonSingle selection
Progress BarVisual progress
SpinnerLoading animation
List ViewScrollable lists
TableData tables
TabsTabbed navigation
ModalDialog overlays
Scroll ViewScrollable containers
Split ViewResizable panes

🖱️ Input

  • Full keyboard event handling
  • Mouse clicks, drags, and scroll
  • Focus management
  • Bracketed paste mode

📐 Layout

  • Flex containers (row/column)
  • Box model with padding/margins
  • Constraint-based sizing
  • Alignment options

🎭 Styling

  • Text attributes (bold, italic, underline, etc.)
  • Built-in themes (Dark, Light, Nord, Dracula, Gruvbox)
  • Custom theme support
  • Various border styles

🎬 Animation

  • Easing functions (linear, ease-in/out, bounce, elastic, etc.)
  • Value interpolation
  • Timer system

Getting Started

Ready to build your first TUI app? Head to the Getting Started guide!

Released under the MIT License.