Documentation
¶
Overview ¶
Package tuiweave is a composable component library for building custom terminal UIs on bubbletea v2 and lipgloss v2, designed so that humans and coding agents can reliably compose and evolve complete frontends with it.
The root package defines the semantic theme roles every component consumes. Layout lives in tuiweave/layout, the snapshot test harness in tuiweave/snaptest, and domain-neutral components live in one package each (e.g. tuiweave/statusbar). Agentic and other domain components live in subpackages such as tuiweave/agentic and are built on the same primitives.
See DESIGN.md for architecture and AGENTS.md for authoring conventions.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Preset ¶ added in v0.2.0
Preset describes one built-in theme. IDs are stable and suitable for application configuration and persistence.
type Theme ¶
type Theme struct {
// Surfaces.
Surface color.Color // app background
SurfaceRaised color.Color // panels, dialogs, popovers
SurfaceSunken color.Color // input wells, code blocks
// Text.
Text color.Color // primary text
TextMuted color.Color // secondary text, placeholders, help
TextFaint color.Color // tertiary text, timestamps, subtle separators
TextInverted color.Color // text rendered on accent/intent fills
// Intent.
Accent color.Color // interactive/brand emphasis
AccentMuted color.Color // subdued accent fills and highlights
Success color.Color
Warning color.Color
Danger color.Color
Info color.Color
// Chrome.
Border color.Color // default borders
BorderFocused color.Color // border of the focused element
BorderMuted color.Color // subtle dividers
// Selection.
SelectionBg color.Color // background of selected rows/items
SelectionFg color.Color // foreground of selected rows/items
}
Theme is the set of semantic color roles that every tuiweave component consumes. Components derive their styles exclusively from these roles and never use color literals, so swapping the Theme restyles an entire app consistently.
Adding a role is an API event: it requires justification that no existing role covers the semantics. This is what keeps the theme surface from growing with every new component.
func CatppuccinLatte ¶ added in v0.2.0
func CatppuccinLatte() Theme
CatppuccinLatte returns the official light Catppuccin flavor. Palette source: https://catppuccin.com/palette/
func CatppuccinMocha ¶ added in v0.2.0
func CatppuccinMocha() Theme
CatppuccinMocha returns the darkest official Catppuccin flavor. Palette source: https://catppuccin.com/palette/
func Dracula ¶ added in v0.2.0
func Dracula() Theme
Dracula returns a theme based on the official Dracula color palette. Palette source: https://spec.draculatheme.com/
func GruvboxDark ¶ added in v0.2.0
func GruvboxDark() Theme
GruvboxDark returns the dark variant of the original Gruvbox palette. Palette source: https://github.com/morhetz/gruvbox
func GruvboxLight ¶ added in v0.2.0
func GruvboxLight() Theme
GruvboxLight returns the light variant of the original Gruvbox palette. Palette source: https://github.com/morhetz/gruvbox
func Nord ¶ added in v0.2.0
func Nord() Theme
Nord returns a theme based on the official Nord color palette. Palette source: https://www.nordtheme.com/docs/colors-and-palettes
func ThemeForPreset ¶ added in v0.2.0
ThemeForPreset resolves a built-in theme by stable preset ID.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package action defines stable, application-owned actions shared by selectable components such as menu, toolbar, and palette.
|
Package action defines stable, application-owned actions shared by selectable components such as menu, toolbar, and palette. |
|
agentic
|
|
|
chat
Package chat provides a scrolling transcript for agentic sessions: a stack of cells (user/assistant messages, tool calls, diffs, notes) inside a viewport that auto-follows new content.
|
Package chat provides a scrolling transcript for agentic sessions: a stack of cells (user/assistant messages, tool calls, diffs, notes) inside a viewport that auto-follows new content. |
|
diffview
Package diffview renders unified diffs with theme-role line coloring — additions Success, deletions Danger, hunk headers Info.
|
Package diffview renders unified diffs with theme-role line coloring — additions Success, deletions Danger, hunk headers Info. |
|
markdown
Package markdown renders markdown to styled terminal text using the theme's roles.
|
Package markdown renders markdown to styled terminal text using the theme's roles. |
|
permission
Package permission provides the modal prompt agentic tools show before a sensitive action: a question with vertically stacked options and optional structured provenance for the operation being approved.
|
Package permission provides the modal prompt agentic tools show before a sensitive action: a question with vertically stacked options and optional structured provenance for the operation being approved. |
|
toolcall
Package toolcall renders a tool invocation as a transcript block: status icon, tool name, argument summary, and collapsible output.
|
Package toolcall renders a tool invocation as a transcript block: status icon, tool name, argument summary, and collapsible output. |
|
usagebar
Package usagebar renders the session status line of an agentic tool: model name, token counts, cost, and context usage, formatted onto a tuiweave statusbar.
|
Package usagebar renders the session status line of an agentic tool: model name, token counts, cost, and context usage, formatted onto a tuiweave statusbar. |
|
Package autocomplete provides a conditional, width-bounded suggestion window for an application-owned text input.
|
Package autocomplete provides a conditional, width-bounded suggestion window for an application-owned text input. |
|
Package button provides a compact, focusable action button.
|
Package button provides a compact, focusable action button. |
|
Package dialog provides a modal confirmation box with OK/Cancel buttons.
|
Package dialog provides a modal confirmation box with OK/Cancel buttons. |
|
examples
|
|
|
autocomplete
command
Autocomplete demonstrates an app-owned textinput paired with the reusable suggestion window.
|
Autocomplete demonstrates an app-owned textinput paired with the reusable suggestion window. |
|
browser
command
Command browser is a mock file-browser reference app.
|
Command browser is a mock file-browser reference app. |
|
chat
command
Command chat is the Phase 3 exit-criterion app: a mock-backed agentic chat session exercising every tuiweave/agentic component — streaming markdown, a tool call gated by a permission prompt, an inline diff, and a live usage bar.
|
Command chat is the Phase 3 exit-criterion app: a mock-backed agentic chat session exercising every tuiweave/agentic component — streaming markdown, a tool call gated by a permission prompt, an inline diff, and a live usage bar. |
|
consumer
command
Command consumer is a small public-API consumer smoke app.
|
Command consumer is a small public-API consumer smoke app. |
|
demo
command
Command demo is the Phase 2 exit-criterion app: a multi-pane TUI composed purely from tuiweave components, laid out with tuiweave/layout, with focus cycling and a modal dialog composited by tuiweave/overlay.
|
Command demo is the Phase 2 exit-criterion app: a multi-pane TUI composed purely from tuiweave components, laid out with tuiweave/layout, with focus cycling and a modal dialog composited by tuiweave/overlay. |
|
frame
command
Command frame demonstrates tuiweave's domain-neutral framing helpers in a small dashboard-like composition.
|
Command frame demonstrates tuiweave's domain-neutral framing helpers in a small dashboard-like composition. |
|
ops
command
Command ops is a non-agentic operations-console reference app.
|
Command ops is a non-agentic operations-console reference app. |
|
palette
command
Command palette demonstrates the reusable command-palette foundation with stable action IDs, filtering, semantic activation, and a framed app shell.
|
Command palette demonstrates the reusable command-palette foundation with stable action IDs, filtering, semantic activation, and a framed app shell. |
|
statusbar
command
Command statusbar demonstrates the tuiweave statusbar component and the canonical app wiring pattern: window size → layout split → SetSize → composed string view.
|
Command statusbar demonstrates the tuiweave statusbar component and the canonical app wiring pattern: window size → layout split → SetSize → composed string view. |
|
table
command
Command table is a mock git-status app: a table of changed files beside a scrollable diff of the selected row, with scrollbars on both panes.
|
Command table is a mock git-status app: a table of changed files beside a scrollable diff of the selected row, with scrollbars on both panes. |
|
textarea-autocomplete
command
Textarea autocomplete demonstrates an app-owned completion engine paired with textarea.ReplaceRange.
|
Textarea autocomplete demonstrates an app-owned completion engine paired with textarea.ReplaceRange. |
|
Package focus provides tab-order managers and copy-safe focus scopes for interactive components.
|
Package focus provides tab-order managers and copy-safe focus scopes for interactive components. |
|
Package frame provides small, domain-neutral decoration helpers for composing tuiweave views.
|
Package frame provides small, domain-neutral decoration helpers for composing tuiweave views. |
|
Package help provides a one-line key-hint bar, e.g.:
|
Package help provides a one-line key-hint bar, e.g.: |
|
Package inspect defines an optional, data-only semantic representation of a tuiweave interface.
|
Package inspect defines an optional, data-only semantic representation of a tuiweave interface. |
|
internal
|
|
|
grapheme
Package grapheme contains small internal helpers for preserving Unicode graphemes while ANSI strings are decomposed into terminal cells.
|
Package grapheme contains small internal helpers for preserving Unicode graphemes while ANSI strings are decomposed into terminal cells. |
|
Package layout partitions terminal space into rectangles using flexbox-like constraints, and sizes tuiweave components from the result.
|
Package layout partitions terminal space into rectangles using flexbox-like constraints, and sizes tuiweave components from the result. |
|
Package line provides small, style-preserving helpers for composing one terminal row.
|
Package line provides small, style-preserving helpers for composing one terminal row. |
|
Package list provides a scrolling list of single-line items with a selection cursor and optional filtering.
|
Package list provides a scrolling list of single-line items with a selection cursor and optional filtering. |
|
Package menu provides a focusable vertical menu of application-owned actions.
|
Package menu provides a focusable vertical menu of application-owned actions. |
|
Package mouse contains small, application-owned helpers for Bubble Tea mouse messages.
|
Package mouse contains small, application-owned helpers for Bubble Tea mouse messages. |
|
Package overlay composites one rendered view on top of another — the mechanism behind modals, popovers, and toasts.
|
Package overlay composites one rendered view on top of another — the mechanism behind modals, popovers, and toasts. |
|
Package palette provides a bounded command-palette foundation: a query input, filtered action window, stable IDs, and semantic activation.
|
Package palette provides a bounded command-palette foundation: a query input, filtered action window, stable IDs, and semantic activation. |
|
Package progress renders a compact, themed progress indicator for a task or operation.
|
Package progress renders a compact, themed progress indicator for a task or operation. |
|
Package scrollbar renders a vertical scroll indicator for any scrolling component.
|
Package scrollbar renders a vertical scroll indicator for any scrolling component. |
|
Package snaptest is tuiweave's snapshot test harness: it renders component views to golden files and compares them on subsequent runs, giving agents (and humans) a deterministic, readable way to verify what a TUI renders without a terminal.
|
Package snaptest is tuiweave's snapshot test harness: it renders component views to golden files and compares them on subsequent runs, giving agents (and humans) a deterministic, readable way to verify what a TUI renders without a terminal. |
|
Package spinner provides an animated activity indicator.
|
Package spinner provides an animated activity indicator. |
|
Package splitpane provides small helpers for composing sibling views into a horizontal split.
|
Package splitpane provides small helpers for composing sibling views into a horizontal split. |
|
Package stack provides small helpers for composing width-aware vertical sections such as headers, body regions, and footers.
|
Package stack provides small helpers for composing width-aware vertical sections such as headers, body regions, and footers. |
|
Package statusbar provides a one-line status bar with themed segments aligned left and right, in the style of editor status lines.
|
Package statusbar provides a one-line status bar with themed segments aligned left and right, in the style of editor status lines. |
|
Package table provides a scrolling table with fixed and flexible columns, a styled header, and row selection.
|
Package table provides a scrolling table with fixed and flexible columns, a styled header, and row selection. |
|
Package tabs provides a one-line, focusable tab strip for navigating sibling views.
|
Package tabs provides a one-line, focusable tab strip for navigating sibling views. |
|
Package textarea provides a multi-line text input for chat-style prompts: soft-wrapped display, a prompt gutter, and content-driven height.
|
Package textarea provides a multi-line text input for chat-style prompts: soft-wrapped display, a prompt gutter, and content-driven height. |
|
Package textinput provides a single-line text input with a prompt, placeholder, cursor, and grapheme-aware horizontal scrolling.
|
Package textinput provides a single-line text input with a prompt, placeholder, cursor, and grapheme-aware horizontal scrolling. |
|
Package toggle provides a compact, focusable on/off control.
|
Package toggle provides a compact, focusable on/off control. |
|
Package toolbar provides a one-line, focusable strip of application-owned actions.
|
Package toolbar provides a one-line, focusable strip of application-owned actions. |
|
Package viewport provides a scrollable window over pre-rendered content.
|
Package viewport provides a scrollable window over pre-rendered content. |