gotui by Carsen Klock is a fully-customizable dashboard and widget Go library built on top of tcell. It is a modernized enhanced fork of termui, engineered for valid TrueColor support, high-performance rendering, flex layouts, rounded borders, input, and for feature parity with robust libraries like ratatui.
- ๐ High Performance: optimized rendering engine capable of ~3000 FPS frame operations with zero-allocation drawing loops. (termui is ~1700 FPS)
- ๐จ TrueColor Support: Full 24-bit RGB color support for modern terminals (Ghostty, Alacritty, Kitty, iTerm2).
- ๐ Flexible Layouts:
- Flex: Mixed fixed/proportional layouts.
- Grid: 12-column dynamic grid system.
- Absolutes: Exact coordinates when needed.
- ๐ SSH / Remote Apps: Turn any TUI into a zero-install SSH accessible application (multi-tenant support).
- ๐จ Gradient Support: Gradient support for widgets.
- ๐ Rich Widgets:
- Charts: BarChart, StackedBarChart, PieChart, DonutChart, RadarChart (Spider), FunnelChart, TreeMap, Sparkline, Plot (Scatter/Line).
- Gauges: Gauge, LineGauge (with pixel-perfect Braille/Block styles).
- Interaction: Input, TextArea, List, Table, Scrollbar.
- Misc: TabPane, Image (block-based), Canvas (Braille), Heatmap.
- ๐ฑ๏ธ Mouse Support: Full mouse event support (Click, Scroll Wheel, Drag).
- ๐ง Customizable: Themes, rounded borders, border titles (alignment).
| Feature | gotui |
termui |
|---|---|---|
| Renderer | tcell (Optimized) |
termbox |
| Performance (FPS) | ~3300 (Heavy Load) | ~1700 |
| Widgets Available | 23+ (Calendar, Tree, Flex...) | ~12 |
| Layout System | Flex + Grid + Absolute | Grid |
| Customization | High (Rounded Borders, Alignments) | Basic |
| Pixel-Perfect | Yes (Braille/Block/Space) | No |
| Mouse Support | Full (Wheel/Click/Drag) | Click |
| TrueColor | Yes | No |
| SSH / Multi-User | Native (Backend API) | No (Global State) |
| Modern Terminal Support | All (iterm, ghostty, etc.) | No |
gotui is backward compatible with termui and can mostly be used as a drop-in replacement.
gotui uses Go modules.
go get github.com/metaspartan/gotui/v4Requires Go Lang 1.24 or higher.
Create a main.go:
package main
import (
"log"
ui "github.com/metaspartan/gotui/v4"
"github.com/metaspartan/gotui/v4/widgets"
)
func main() {
if err := ui.Init(); err != nil {
log.Fatalf("failed to initialize gotui: %v", err)
}
defer ui.Close()
p := widgets.NewParagraph()
p.Title = "Hello World"
p.Text = "PRESS q TO QUIT.\n\nCombined with modern widgets, gotui aims to provide the best TUI experience in Go."
p.SetRect(0, 0, 50, 5)
p.TitleStyle.Fg = ui.ColorYellow
p.BorderStyle.Fg = ui.ColorSkyBlue
ui.Render(p)
uiEvents := ui.PollEvents()
for {
e := <-uiEvents
switch e.ID {
case "q", "<C-c>":
return
}
}
}Run the main dashboard demo: go run _examples/dashboard/main.go
Run individual examples: go run _examples/<name>/main.go
*Widget Screenshots are auto generated.
gotui supports Rounded Borders and various title alignments.
p.Border = true
p.BorderRounded = true // โญโโโโฎ instead of โโโโโ
p.Title = "My Title"
p.TitleAlignment = ui.AlignLeft // or AlignCenter, AlignRight
p.TitleBottom = "Page 1"
p.TitleBottomAlignment = ui.AlignRightEvents include MouseLeft, MouseRight, MouseRelease, MouseWheelUp, MouseWheelDown.
uiEvents := ui.PollEvents()
for e := range uiEvents {
if e.Type == ui.MouseEvent {
// e.ID is "MouseLeft", "MouseWheelUp", etc.
// e.Payload.X, e.Payload.Y are coordinates
}
}You can easily serve your TUI over SSH (like standard CLI apps) using ui.InitWithConfig and a library like gliderlabs/ssh.
func sshHandler(sess ssh.Session) {
// 1. Create a custom backend for this session
app, err := ui.NewBackend(&ui.InitConfig{
CustomTTY: sess, // ssh.Session implements io.ReadWriter
})
if err != nil {
return // Handle error appropriately
}
defer app.Close()
// 2. Use the app instance instead of global ui.* functions
p := widgets.NewParagraph()
p.Text = "Hello SSH User!"
p.SetRect(0, 0, 20, 5)
app.Render(p) // Renders to the SSH client only!
}Check _examples/ssh-dashboard for a full multi-user demo.
Contributions are welcome! Please submit a Pull Request.
- Fork the repo.
- Create your feature branch (
git checkout -b feature/my-new-feature). - Commit your changes (
git commit -am 'Add some feature'). - Push to the branch (
git push origin feature/my-new-feature). - Create a new Pull Request.
Submit a PR to add yours here!
Carsen Klock (https://x.com/carsenklock)
Zack Guo (https://github.com/gizak)
Original termui by Zack Guo.
Inspired by Ratatui.