Open-Source Wikis

/

Bubble Tea

/

Reference

/

Messages

charmbracelet/bubbletea

Messages

Every public message type defined by Bubble Tea. The runtime produces messages from terminal events, command callbacks, signals, and internal sentinel sources; user code sees them all through Update.

Special program messages

Defined in tea.go.

Type Source Effect
QuitMsg tea.Quit cmd, signal handler Loop returns.
InterruptMsg tea.Interrupt, SIGINT Loop returns with ErrInterrupted.
SuspendMsg tea.Suspend Triggers the suspend dance.
ResumeMsg After resuming from suspend Lets the model react to coming back.

Lifecycle / size

Type File Effect
WindowSizeMsg screen.go Initial + on resize. Has Width, Height.
EnvMsg environ.go One-shot snapshot of the program's environ. Has Getenv and LookupEnv.
ColorProfileMsg profile.go Sent at startup; emitted again when the profile is upgraded after RequestCapability.

Keyboard

Type File Notes
KeyMsg (interface) key.go Implemented by both KeyPressMsg and KeyReleaseMsg.
KeyPressMsg key.go Press event. Has String(), Keystroke(), and Key().
KeyReleaseMsg key.go Release event. Only delivered when View.KeyboardEnhancements.ReportEventTypes is true.
KeyboardEnhancementsMsg keyboard.go Reply to a keyboard-enhancement request. Use the Supports* methods.

Mouse

Type File Notes
MouseMsg (interface) mouse.go Implemented by all mouse sub-messages.
MouseClickMsg mouse.go Button press.
MouseReleaseMsg mouse.go Button release.
MouseWheelMsg mouse.go Scroll.
MouseMotionMsg mouse.go Pointer movement.

Paste / focus / clipboard

Type File Notes
PasteMsg paste.go One paste chunk.
PasteStartMsg / PasteEndMsg paste.go Brackets around a paste sequence.
FocusMsg / BlurMsg focus.go Terminal focus gained / lost. Requires View.ReportFocus = true.
ClipboardMsg clipboard.go OSC 52 read result. Selection is 'c' or 'p'.

Color and cursor

Type File Notes
ForegroundColorMsg / BackgroundColorMsg / CursorColorMsg color.go Replies to the corresponding Request* commands. Each has IsDark().
CursorPositionMsg cursor.go Reply to RequestCursorPosition.

Mode reports / capabilities / version

Type File Notes
ModeReportMsg screen.go DECRPM reply. Carries Mode and Value.
CapabilityMsg termcap.go XTGETTCAP reply. Content is the capability string.
TerminalVersionMsg xterm.go XTVERSION reply.

Internal helpers / batch

Type File Notes
BatchMsg commands.go Carries a []Cmd for concurrent dispatch. Public so user code can build batches manually if needed.
RawMsg raw.go Wrapper for tea.Raw(any).

Internal sentinel messages (lowercase)

These are not exported but appear in the runtime switch:

  • clearScreenMsg, windowSizeMsg, requestCursorPosMsg, setClipboardMsg, readClipboardMsg, setPrimaryClipboardMsg, readPrimaryClipboardMsg, backgroundColorMsg, foregroundColorMsg, cursorColorMsg, terminalVersion, requestCapabilityMsg, sequenceMsg, printLineMessage, execMsg.

User code never constructs them directly; the corresponding public Cmd helpers do.

Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.

Messages – Bubble Tea wiki | Factory