Quick Start
This guide walks you through a minimal dado app: a data grid themed with Nord.
1. Create a new module
Section titled “1. Create a new module”mkdir my-tui && cd my-tuigo mod init example.com/my-tuigo get github.com/atterpac/dado@latest2. Write the app
Section titled “2. Write the app”package main
import ( "fmt"
"github.com/atterpac/dado" "github.com/atterpac/dado/components" "github.com/atterpac/dado/theme")
type Process struct { Name string PID int Status string}
var processes = []Process{ {"nginx", 1001, "running"}, {"postgres", 1042, "running"}, {"redis", 2200, "sleeping"},}
func main() { app := dado.New() app.SetTheme(theme.Nord)
rows := make([][]string, len(processes)) for i, p := range processes { rows[i] = []string{p.Name, fmt.Sprint(p.PID), p.Status} }
grid := components.NewDataGrid(). SetColumns([]string{"Name", "PID", "Status"}). SetRows(rows). OnActivate(func(row int) { // called when the user presses Enter on a row })
app.SetRoot(grid, true) if err := app.Run(); err != nil { panic(err) }}3. Run it
Section titled “3. Run it”go run .A full-screen data grid with keyboard navigation (arrow keys / j/k to move,
Enter to activate a row).
Next steps
Section titled “Next steps”- Themes — switch or customise the colour scheme
- Key Bindings — add global and per-component shortcuts
- Events — respond to focus, change, and submit events
- Components — explore the full catalog