bubbletea: A Go framework for building stateful terminal applications with the functional design paradigms of The Elm Architecture.
What problem it solves
Building interactive terminal applications requires coordinating application state, incoming events, side effects, and rendering. Bubble Tea provides a functional, stateful structure for organizing these responsibilities in Go.
Key features
Stateful application model — Applications keep their state in a model and use Init, Update, and View to organize initialization, event handling, and rendering.
Source: README
Declarative terminal views — A view describes the interface and can include terminal features such as alt screen mode, mouse tracking, and cursor position without requiring explicit redraw logic.
Source: README
Keyboard, mouse, and clipboard support — The framework includes high-fidelity input handling and native clipboard support for interactive terminal interfaces.
Source: README, keyboard.go, mouse.go
Program resume protocol — Applications can provide a restart command so supporting terminals can bring the program back after a terminal restart.
Source: programresume.go
Quick start
Copied verbatim from the project's README.
go get charm.land/bubbletea/v2@latesttype model struct {
choices []string // items on the to-do list
cursor int // which to-do list item our cursor is pointing at
selected map[int]struct{} // which to-do items are selected
}func main() {
p := tea.NewProgram(initialModel())
if _, err := p.Run(); err != nil {
fmt.Printf("Alas, there's been an error: %v", err)
os.Exit(1)
}
}Who it may suit
This framework may suit Go developers building simple or complex terminal applications that are inline, full-window, or combine both layouts.
Topics to discuss
Which terminal application types would benefit most from Bubble Tea's model, Update, and View structure?
How do you organize side effects and asynchronous commands in Bubble Tea applications?
What patterns have you found effective for testing interactive terminal interfaces built with Bubble Tea?
Written by ReadmeX AI from the project's README, source and public GitHub data; it may contain mistakes.
Read the original README https://github.com/charmbracelet/bubbletea#readme
ReadmeX opened this community for a trending project; it is not run by the project. Maintainers can claim it from the community page.
Comments
…