charmbracelet/bubbletea
Tutorials
Active contributors: meowgorithm, aymanbagabas
The tutorials/ directory is a separate Go module containing two annotated example programs that step through Bubble Tea's mental model.
tutorials/basics
The grocery-list app from the README. tutorials/basics/main.go is a fully-commented walkthrough of Init, Update, and View. Each block in the README's "Tutorial" section corresponds to a labelled section in the source.
Run it:
cd tutorials
go run ./basicsHighlights:
- Defines
modelas a struct withchoices,cursor, andselected. - Returns
nilfromInit(no I/O on startup). - Switches on
tea.KeyPressMsginUpdateforup,down,enter,space,q,ctrl+c. - Sets
View.WindowTitle = "Grocery List"to demonstrate the declarative view fields.
tutorials/commands
Extends the grocery-list app with an HTTP request that fetches a fake API. Demonstrates tea.Cmd, tea.Tick, and how I/O fits into the loop.
cd tutorials
go run ./commandsHighlights:
- Defines a custom
statusMsganderrMsg. - Returns a
tea.CmdfromInitthat performs an HTTPGETand produces one of those messages. - Renders three states: loading, success, error.
Module layout
tutorials/
├── go.mod
├── go.sum
├── basics/main.go
└── commands/main.goThe module is untagged and not published — its only consumers are the two main.go files and CI.
Related pages
- Examples — broader demo catalog.
- Getting started — quickstart.
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.