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:
- Simple API - As easy to use as Python, but with Zig's performance
- Zero Dependencies - Pure Zig, no external C libraries
- Cross-Platform - Works on Linux, Windows, macOS, and BSD
- High Performance - Diff-based rendering, double buffering
- 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:
| Widget | Description |
|---|---|
| Text | Styled text with alignment |
| Button | Clickable with hover states |
| Input Field | Single-line text input |
| Text Area | Multi-line editor |
| Checkbox | Toggle checkboxes |
| Radio Button | Single selection |
| Progress Bar | Visual progress |
| Spinner | Loading animation |
| List View | Scrollable lists |
| Table | Data tables |
| Tabs | Tabbed navigation |
| Modal | Dialog overlays |
| Scroll View | Scrollable containers |
| Split View | Resizable 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!