Bubbles Component Catalog
All components live under charm.land/bubbles/v2/<package>.
spinner
Animated loading indicator with preset and custom frame sets.
Key Types:
Model- component state (Spinner, Style fields)Spinner- frame definition (Frames []string,FPS time.Duration)TickMsg- animation frame message
Presets: Line, Dot, MiniDot, Jump, Pulse, Points, Globe, Moon, Monkey, Meter, Hamburger, Ellipsis
Constructor:
s := spinner.New(spinner.WithSpinner(spinner.Dot), spinner.WithStyle(style))
Start: Return m.spinner.Tick from your Init().
Usage:
m.spinner, cmd = m.spinner.Update(msg)
view := m.spinner.View()
textinput
Single-line text input with cursor, placeholder, validation, echo modes, and autocomplete suggestions.
Key Types:
Model- component stateKeyMap- customizable keybindingsEchoMode-EchoNormal,EchoPassword,EchoNoneValidateFunc-func(string) errorStyles- focused/blurred state styles
Constructor:
ti := textinput.New()
ti.Placeholder = "Type here..."
ti.CharLimit = 100
ti.SetWidth(40)
Key Methods:
Focus() tea.Cmd/Blur()- focus managementValue() string/SetValue(string)- get/set contentSetSuggestions([]string)- autocomplete suggestions (setShowSuggestions = true)SetStyles(Styles)- apply stylesValidate ValidateFunc- assign validation function, errors go toErrfield
textarea
Multi-line text editor with line numbers, word wrapping, cursor navigation, and viewport scrolling.
Key Types:
Model- component stateKeyMap- extensive keybindings (character/word/line movement, case transforms, transpose)LineInfo- cursor position metadata
Constructor:
ta := textarea.New()
ta.SetWidth(60)
ta.SetHeight(10)
ta.Placeholder = "Enter text..."
ta.ShowLineNumbers = true
Key Methods:
Focus() tea.Cmd/Blur()- focus managementValue() string/SetValue(string)- get/set contentLine() int/LineCount() int- cursor line infoSetStyles(Styles)- focused/blurred styles
list
Batteries-included list browser with fuzzy filtering, pagination, help, spinner, and status messages.
Key Types:
Model- component stateIteminterface - must implementFilterValue() stringItemDelegateinterface -Render,Height,Spacing,UpdatemethodsFilterState-Unfiltered,Filtering,FilterAppliedFilterFunc- custom filter functionRank- filter match result
Constructor:
items := []list.Item{myItem1, myItem2}
l := list.New(items, myDelegate, width, height)
l.Title = "My List"
Key Methods:
SetItems([]Item)/Items() []Item- manage itemsSelectedItem() Item/Index() int- get selectionSetSize(w, h int)- resizeSetFilteringEnabled(bool)- toggle filteringNewStatusMessage(string) tea.Cmd- show temporary statusSetShowHelp(bool)/SetShowTitle(bool)/SetShowFilter(bool)- toggle UI elements
Built-in Filter: list.DefaultFilter (fuzzy), list.UnsortedFilter
table
Tabular data display with row selection and keyboard navigation.
Key Types:
Model- component stateRow-[]stringColumn-Title string,Width intKeyMap- up/down/page/goto keybindingsStyles-Header,Cell,Selected
Constructor:
t := table.New(
table.WithColumns([]table.Column{
{Title: "Name", Width: 20},
{Title: "Age", Width: 5},
}),
table.WithRows([]table.Row{
{"Alice", "30"},
{"Bob", "25"},
}),
table.WithHeight(10),
table.WithFocused(true),
)
Key Methods:
Focus()/Blur()- focus managementSelectedRow() Row/Cursor() int- get selectionSetRows([]Row)/SetColumns([]Column)- update dataSetWidth(int)/SetHeight(int)- resizeSetCursor(int)- set selection indexFromValues(value, separator string)- parse string dataHelpView() string- render help from keymapUpdateViewport()- refresh after data changes
viewport
Scrollable content viewer with vertical/horizontal scrolling, soft wrap, mouse wheel, line gutters, and text highlighting.
Key Types:
Model- component stateKeyMap- scroll keybindings (Up/Down/Left/Right/PageUp/PageDown/HalfPageUp/HalfPageDown)GutterFunc/GutterContext- left gutter rendering (line numbers, etc.)
Constructor:
vp := viewport.New(viewport.WithWidth(80), viewport.WithHeight(24))
vp.SetContent("long text content here...")
Key Methods:
SetContent(string)/GetContent() string- set/get contentSetContentLines([]string)- set content as linesSetWidth(int)/SetHeight(int)- resizeScrollDown(n)/ScrollUp(n)/ScrollLeft(n)/ScrollRight(n)- scrollGotoTop()/GotoBottom()- jump to extremesAtTop() bool/AtBottom() bool- position checksScrollPercent() float64- scroll progress (0-1)YOffset() int/SetYOffset(int)- vertical positionSetHighlights([][]int)/HighlightNext()/HighlightPrevious()- search highlightingEnsureVisible(line, colstart, colend int)- scroll to show position
Fields:
SoftWrap bool- enable word wrap (disables horizontal scroll)FillHeight bool- pad with empty linesMouseWheelEnabled bool/MouseWheelDelta int- mouse configLeftGutterFunc GutterFunc- line number gutterStyle lipgloss.Style- border/padding styleHighlightStyle/SelectedHighlightStyle- search match stylesStyleLineFunc func(int) lipgloss.Style- per-line styling
paginator
Pagination logic and display (dot or numeric style).
Key Types:
Model- component stateType-Arabic(1/5),Dots(bullet dots)KeyMap-PrevPage,NextPage
Constructor:
p := paginator.New(paginator.WithPerPage(10), paginator.WithTotalPages(5))
Key Methods:
NextPage()/PrevPage()- navigateSetTotalPages(itemCount int) int- calculate pages from item countGetSliceBounds(length int) (start, end int)- get slice indices for current pageItemsOnPage(totalItems int) int- items on current pageOnFirstPage() bool/OnLastPage() bool- position checks
Fields: Page, PerPage, TotalPages, ActiveDot, InactiveDot, ArabicFormat
progress
Animated progress bar with solid, gradient, and dynamic color fills.
Key Types:
Model- component stateFrameMsg- animation tickColorFunc-func(total, current float64) color.Color
Constructor:
p := progress.New(
progress.WithDefaultBlend(), // purple-to-pink gradient
progress.WithWidth(40),
progress.WithoutPercentage(),
)
// Or solid color:
p := progress.New(progress.WithColors(lipgloss.Color("#FF0000")))
// Or dynamic:
p := progress.New(progress.WithColorFunc(myColorFunc))
Key Methods:
SetPercent(float64) tea.Cmd- animate to percentage (0-1), returns cmdIncrPercent(float64) tea.Cmd/DecrPercent(float64) tea.Cmd- relative changesViewAs(float64) string- static render at given percentage (no animation)View() string- render current animated statePercent() float64- current target percentageIsAnimating() bool- whether animation is in progressSetWidth(int)/Width() int- resizeSetSpringOptions(frequency, damping float64)- animation physics
Fields: Full, Empty (runes), FullColor, EmptyColor, ShowPercentage, PercentFormat, PercentageStyle
help
Auto-generated horizontal help view from keybindings. Supports short (single line) and full (multi-column) modes.
Key Types:
Model- component stateKeyMapinterface -ShortHelp() []key.Binding,FullHelp() [][]key.BindingStyles- separate styles for short/full key/desc/separator
Constructor:
h := help.New()
h.SetWidth(80)
Usage:
// Pass your KeyMap implementation
view := h.View(myKeyMap)
// Or render directly
view := h.ShortHelpView(bindings)
view := h.FullHelpView(bindingGroups)
Fields: ShowAll bool (toggle short/full), ShortSeparator, FullSeparator, Ellipsis
filepicker
File system browser for selecting files/directories.
Key Types:
Model- component stateKeyMap- navigation keys (Up/Down/Back/Open/Select/PageUp/PageDown/GoToTop/GoToLast)Styles- styles for cursor, directory, file, symlink, permissions, etc.
Constructor:
fp := filepicker.New()
fp.CurrentDirectory = "/home/user"
fp.AllowedTypes = []string{".go", ".md"}
fp.DirAllowed = false
fp.FileAllowed = true
fp.ShowHidden = true
Key Methods:
DidSelectFile(msg tea.Msg) (bool, string)- check if user selected a valid fileDidSelectDisabledFile(msg tea.Msg) (bool, string)- check if user tried to select a disallowed file
Fields: CurrentDirectory, AllowedTypes, ShowPermissions, ShowSize, ShowHidden, DirAllowed, FileAllowed, AutoHeight, Path, FileSelected
timer
Countdown timer with configurable interval.
Key Types:
Model- component stateTickMsg- periodic tick (hasTimeout boolflag)TimeoutMsg- sent once when timer expiresStartStopMsg- control message
Constructor:
t := timer.New(30*time.Second, timer.WithInterval(100*time.Millisecond))
Start: Return m.timer.Init() from your Init().
Key Methods:
Start() tea.Cmd/Stop() tea.Cmd/Toggle() tea.Cmd- controlRunning() bool/Timedout() bool- state queriesView() string- renders remaining time
Fields: Timeout time.Duration, Interval time.Duration
stopwatch
Count-up timer with start/stop/reset.
Key Types:
Model- component stateTickMsg- periodic tickStartStopMsg/ResetMsg- control messages
Constructor:
sw := stopwatch.New(stopwatch.WithInterval(100*time.Millisecond))
Start: Return m.stopwatch.Init() from your Init().
Key Methods:
Start() tea.Cmd/Stop() tea.Cmd/Toggle() tea.Cmd/Reset() tea.Cmd- controlRunning() bool- state queryElapsed() time.Duration- get elapsed timeView() string- renders elapsed time
Fields: Interval time.Duration
cursor
Virtual cursor used internally by textinput and textarea. Supports blink, static, and hidden modes.
Key Types:
Model- cursor stateMode-CursorBlink,CursorStatic,CursorHideBlinkMsg- blink tick
Constructor:
c := cursor.New()
Key Methods:
Focus() tea.Cmd/Blur()- focus managementSetMode(Mode) tea.Cmd- set cursor behaviorMode() Mode- get current modeSetChar(string)- character under cursorBlink() tea.Cmd- start blink cycle
Fields: Style, TextStyle, BlinkSpeed, IsBlinked
key
Non-visual utility for defining remappable keybindings with help text integration.
Key Types:
Binding- a set of keys with optional help textBindingOpt- functional option for NewBindingHelp-Key string,Desc string
Constructor:
b := key.NewBinding(
key.WithKeys("k", "up"),
key.WithHelp("up/k", "move up"),
)
Key Functions:
key.Matches(key fmt.Stringer, bindings ...Binding) bool- check if key matches any binding
Key Methods on Binding:
Enabled() bool/SetEnabled(bool)- enable/disableKeys() []string/SetKeys(...string)- get/set keysHelp() Help/SetHelp(key, desc string)- get/set help textUnbind()- remove all keys and help
runeutil (internal)
Internal sanitizer for cleaning rune input (tab/newline replacement). Not part of the public API.