A component-based Terminal User Interface framework for Go, built on top of gocui and lazycore.
LazyTui is a high-level TUI framework designed to reduce the boilerplate required for building terminal applications. As someone who enjoys working with terminal applications, I found myself repeatedly implementing the same patterns for panels, modals, focus management, and layouts. This framework wraps gocui and lazycore to provide a clean, component-based architecture that allows you to focus on building features rather than wrestling with low-level terminal APIs.
Inspired by LazyGit, LazyTui provides a similar component system that makes it easy to create professional, interactive terminal UIs.
- Component-Based Architecture - Reusable UI components with interface-driven design
- Built-in Components - Panel, TextPanel, ListPanel, TabPanel, StatusBar, and Modal dialogs
- Flexible Layout System - Powered by lazycore's box layout engine
- Focus Management - Automatic focus handling with keyboard and mouse support
- Background Tasks - Execute long-running tasks with spinner overlay and real-time UI updates
- Keybinding System - Global and view-specific keybindings with automatic StatusBar display
- Modal Dialogs - OkOnly, YesNo, and InputModal with colour-coded types
- Thread-Safe Updates - Safe UI updates from goroutines via
App.Refresh() - Generic List Items - Type-safe list components with custom data binding
- Debug Logging - Built-in logging system for development
go get github.com/DokaDev/lazytuiRequirements:
- Go 1.21 or higher
- Terminal with UTF-8 support
Dependencies:
require (
github.com/jesseduffield/gocui v0.3.1-0.20251002151855-67e0e55ff42a
github.com/jesseduffield/lazycore v0.0.0-20221012050358-03d2e40243c5
)Here's a minimal example to get started:
package main
import (
"github.com/jesseduffield/lazycore/pkg/boxlayout"
)
func main() {
// Create application
app, _ := NewApp(AppConfig{
AppName: "MyApp",
Version: "1.0.0",
})
// Create a text panel
panel := NewTextPanel("main", "Hello LazyTui", "", "", true)
panel.SetContent("Welcome to LazyTui!\n\nPress 'q' to quit.")
// Register component and set layout
app.RegisterComponent(panel)
app.SetLayoutStrategy(&boxlayout.Box{
Window: "main",
Weight: 1,
})
// Run application
app.Run()
}This repository includes a comprehensive demo application showcasing all framework features:
# Clone the repository
git clone https://github.com/DokaDev/lazytui
cd lazytui
# Run the demo
go run .The demo includes:
- Process Monitor - List panel with system process information
- File Browser - Interactive file system navigation
- Command Execution - Background tasks with real-time output streaming
- Activity Log - Real-time logging panel
- Modal Dialogs - Examples of all modal types
- Tab Navigation - Multiple tab panels with dynamic content
q- Quit application←/→- Switch between panels↑/↓- Scroll or navigate listsTab/Shift+Tab- Switch tabs (in TabPanel)ESC- Close modal dialogsr- Refresh panelsm- Show modal examples- Mouse support enabled (click to focus, wheel to scroll)
LazyTui is built on the excellent work of:
- gocui by Jesse Duffield - Terminal UI library
- lazycore by Jesse Duffield - Box layout system
- Inspired by LazyGit - A fantastic terminal UI for Git
Special thanks to Jesse Duffield for creating and maintaining these foundational libraries.