[go-fan] Go Module Review: charmbracelet/bubbles #21351
Closed
Replies: 2 comments 1 reply
-
|
/plan |
Beta Was this translation helpful? Give feedback.
1 reply
-
|
This discussion has been marked as outdated by Go Fan. A newer discussion is available at Discussion #21536. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
🐹 Go Fan Report: charmbracelet/bubbles
Today's priority pick:
github.com/charmbracelet/bubbles— the repo was pushed today (2026-03-17) with a dependency update tocharm.land/bubbletea/v2@2.0.2andcharm.land/lipgloss/v2@2.0.2, making it the most recently active unreviewed direct dependency.Module Overview
Bubbles is the official TUI component library for the Bubble Tea framework. It provides production-ready, reusable UI primitives — spinners, progress bars, text inputs, text areas, lists, viewports, tables, file pickers, and more — all implementing the
tea.Modelinterface and fitting naturally into the Elm Architecture.Version in⚠️
go.mod:v1.0.0Latest release:
v2.0.0(released 2026-02-24)Current Usage in gh-aw
pkg/console/spinner,progress,listpkg/console/spinner.gospinnerspinner.New(),spinner.MiniDot,spinner.WithStyle(),spinner.TickMsgpkg/console/progress.goprogressprogress.New(),WithScaledGradient(),WithWidth(),ViewAs(),EmptyColorfieldpkg/console/list.golistlist.New(),Styles.FilterPrompt,Styles.FilterCursor, customItemDelegateNotable patterns:
tea.WithoutRenderer()with manual carriage-return clearing — idiomatic for non-full-screen spinnerstea.WithAltScreen()for a full-screen selection experienceResearch Findings: v2 is Here!
The bubbles library just shipped v2.0.0 — the biggest release in the project's history. The main highlights:
Recent Updates (v1 → v2)
charm.land/bubbles/v2— module path changed entirelyWidth/Heightfields replaced withSetWidth()/Width()methodsNew(...Option)instead of positional argsDefaultKeyMap())textareaandtextinputnow support terminal-native cursors (opt-in)Best Practices from Maintainers
tea.RequestBackgroundColor+BackgroundColorMsgfor proper light/dark detection (rather than blocking I/O)DefaultStyles(isDark bool)on components that support it (help,list,textarea,textinput)DefaultKeyMap()(function) over the old variable to get fresh valuesImprovement Opportunities
The project is on v1.0.0 while v2.0.0 is available. Three specific breakages would need fixing on upgrade:
Breaking changes detail
1.
pkg/console/progress.go—WithScaledGradientrenamed (line 53)2.
pkg/console/progress.go—EmptyColorfield type change (line 58)3.
pkg/console/list.go—FilterPrompt/FilterCursorconsolidated (lines 166–170)🏃 Quick Wins (v1-compatible)
These improvements apply now, without upgrading:
list.goL154: The hardcoded dimensionslist.New(listItems, delegate, 80, 20)ignore the terminal's actual size. Consider initializing with a sensible default and handlingtea.WindowSizeMsgto also update the list height (currently only width is updated on resize)progress.go: The indeterminate pulsing animation manually steps through 8 states; bubbles'progresscomponent supports animation via Harmonica natively — consider usingprogress.IncrPercent()/DecrPercent()withprogress.FrameMsgto get smoother hardware-accelerated animation✨ Feature Opportunities (v2)
Once migrated to v2:
viewportsupportsLeftGutterFunc(line numbers!), regex highlights viaSetHighlights(), and soft wrapping — a great fit for displaying structured workflow output ingh-awWithColorFunc: Enable dynamic color transitions — e.g., shift to red on error, green at 100% completiontea.RequestBackgroundColor+BackgroundColorMsgin the list model'sInit()to properly adapt to the user's terminal background📐 Best Practice Alignment
tea.WithoutRenderer()+ manual print approach is well-executed and remains valid in v2list.gocorrectly propagatestea.WindowSizeMsgto the list width, but could also update heightRecommendations
WindowSizeMsgfor list height, not just width (list.goL49)viewportfor workflow output display (line numbers, highlights)tea.RequestBackgroundColorto the list model for light/dark theme adaptationNext Steps
bubbleteaandlipglossupgrades (all part of the Charm v2 ecosystem — they go together)Generated by Go Fan 🐹
Module summary saved to:
scratchpad/mods/bubbles.mdWorkflow run: §23182991466
References:
Beta Was this translation helpful? Give feedback.
All reactions