Documentation
¶
Index ¶
- func AllBindings() []key.Binding
- func ConnectionIndicator(connected bool) string
- func CounterIndicator(label string, current, total int) string
- func HelpBinding(keys, desc string) string
- func IsDown(msg tea.KeyMsg) bool
- func IsEnter(msg tea.KeyMsg) bool
- func IsEscape(msg tea.KeyMsg) bool
- func IsHelp(msg tea.KeyMsg) bool
- func IsLeft(msg tea.KeyMsg) bool
- func IsQuit(msg tea.KeyMsg) bool
- func IsRight(msg tea.KeyMsg) bool
- func IsTab(msg tea.KeyMsg) bool
- func IsUp(msg tea.KeyMsg) bool
- func ModeIndicator(mode string, active bool) string
- func NavigationBindings() []key.Binding
- func QuickHelp(pairs ...string) string
- func QuitBindings() []key.Binding
- func RenderBadge(text string, render ...func(string) string) string
- func RenderBytes(bytes int64) string
- func RenderCountBadge(count int, label string) string
- func RenderDetailPanel(title string, pairs []KeyValuePair, width int) string
- func RenderDivider(width int) string
- func RenderEmptyState(message string, width, height int) string
- func RenderError(err error, width int) string
- func RenderHeader(cfg HeaderConfig) string
- func RenderHelpBar(bindings []key.Binding, width int) string
- func RenderHelpGrid(bindings []key.Binding, columns, width int) string
- func RenderInfoPanel(title, content string, width int) string
- func RenderKeyValueTable(pairs []KeyValuePair, width int) string
- func RenderLabelValue(label, value string) string
- func RenderLabeledDivider(label string, width int) string
- func RenderPercentage(value float64) string
- func RenderProgress(cfg ProgressConfig) string
- func RenderScrollablePanel(title string, lines []string, offset, visibleLines, width int) string
- func RenderStatus(cfg StatusConfig) string
- func RenderStatusBar(left, center, right string, width int) string
- func RenderStatusBarWithSections(sections []StatusBarSection, width int) string
- func RenderStepperBar(steps []Step, width int) string
- func RenderTable(cfg TableConfig) string
- func RenderTag(text string, render ...func(string) string) string
- func RenderTags(tags []string, render ...func(string) string) string
- func RunProgram(ios *iostreams.IOStreams, model tea.Model, opts ...ProgramOption) (tea.Model, error)
- func TimerIndicator(label string, value string) string
- type ConfirmField
- func (f ConfirmField) BoolValue() bool
- func (f ConfirmField) Init() tea.Cmd
- func (f ConfirmField) IsConfirmed() bool
- func (f ConfirmField) SetSize(w, h int) ConfirmField
- func (f ConfirmField) Update(msg tea.Msg) (ConfirmField, tea.Cmd)
- func (f ConfirmField) Value() string
- func (f ConfirmField) View() string
- type DashboardConfig
- type DashboardRenderer
- type DashboardResult
- type FieldOption
- type HeaderConfig
- type HelpConfig
- type HelpModel
- func (m HelpModel) Bindings() []key.Binding
- func (m HelpModel) FullHelp() string
- func (m HelpModel) SetBindings(bindings []key.Binding) HelpModel
- func (m HelpModel) SetSeparator(sep string) HelpModel
- func (m HelpModel) SetShowAll(showAll bool) HelpModel
- func (m HelpModel) SetWidth(width int) HelpModel
- func (m HelpModel) ShortHelp() string
- func (m HelpModel) View() string
- type HookResult
- type KeyMap
- type KeyValuePair
- type LifecycleHook
- type ListConfig
- type ListItem
- type ListModel
- func (m ListModel) IsEmpty() bool
- func (m ListModel) Items() []ListItem
- func (m ListModel) Len() int
- func (m ListModel) PageDown() ListModel
- func (m ListModel) PageUp() ListModel
- func (m ListModel) Select(index int) ListModel
- func (m ListModel) SelectFirst() ListModel
- func (m ListModel) SelectLast() ListModel
- func (m ListModel) SelectNext() ListModel
- func (m ListModel) SelectPrev() ListModel
- func (m ListModel) SelectedIndex() int
- func (m ListModel) SelectedItem() ListItem
- func (m ListModel) SetHeight(height int) ListModel
- func (m ListModel) SetItems(items []ListItem) ListModel
- func (m ListModel) SetShowDescriptions(show bool) ListModel
- func (m ListModel) SetWidth(width int) ListModel
- func (m ListModel) SetWrap(wrap bool) ListModel
- func (m ListModel) Update(msg tea.Msg) (ListModel, tea.Cmd)
- func (m ListModel) View() string
- type PanelConfig
- type PanelGroup
- func (g PanelGroup) Add(panel PanelModel) PanelGroup
- func (g PanelGroup) Focus(index int) PanelGroup
- func (g PanelGroup) FocusNext() PanelGroup
- func (g PanelGroup) FocusPrev() PanelGroup
- func (g PanelGroup) FocusedIndex() int
- func (g PanelGroup) FocusedPanel() PanelModel
- func (g PanelGroup) Panels() []PanelModel
- func (g PanelGroup) RenderHorizontal(gap int) string
- func (g PanelGroup) RenderVertical(gap int) string
- type PanelModel
- func (p PanelModel) Content() string
- func (p PanelModel) Height() int
- func (p PanelModel) IsFocused() bool
- func (p PanelModel) SetContent(content string) PanelModel
- func (p PanelModel) SetFocused(focused bool) PanelModel
- func (p PanelModel) SetHeight(height int) PanelModel
- func (p PanelModel) SetPadding(padding int) PanelModel
- func (p PanelModel) SetTitle(title string) PanelModel
- func (p PanelModel) SetWidth(width int) PanelModel
- func (p PanelModel) Title() string
- func (p PanelModel) View() string
- func (p PanelModel) Width() int
- type ProgramOption
- type ProgressConfig
- type ProgressDisplayConfig
- type ProgressResult
- type ProgressStep
- type ProgressStepStatus
- type SelectField
- func (f SelectField) Init() tea.Cmd
- func (f SelectField) IsConfirmed() bool
- func (f SelectField) SelectedIndex() int
- func (f SelectField) SetSize(w, h int) SelectField
- func (f SelectField) Update(msg tea.Msg) (SelectField, tea.Cmd)
- func (f SelectField) Value() string
- func (f SelectField) View() string
- type SimpleListItem
- type SpinnerModel
- type SpinnerTickMsg
- type SpinnerType
- type StatusBarModel
- func (m StatusBarModel) Center() string
- func (m StatusBarModel) Left() string
- func (m StatusBarModel) Right() string
- func (m StatusBarModel) SetCenter(s string) StatusBarModel
- func (m StatusBarModel) SetLeft(s string) StatusBarModel
- func (m StatusBarModel) SetRight(s string) StatusBarModel
- func (m StatusBarModel) SetWidth(width int) StatusBarModel
- func (m StatusBarModel) View() string
- func (m StatusBarModel) Width() int
- type StatusBarSection
- type StatusConfig
- type Step
- type StepState
- type TUI
- func (t *TUI) IOStreams() *iostreams.IOStreams
- func (t *TUI) NewTable(headers ...string) *TablePrinter
- func (t *TUI) RegisterHooks(hooks ...LifecycleHook)
- func (t *TUI) RunProgress(mode string, cfg ProgressDisplayConfig, ch <-chan ProgressStep) ProgressResult
- func (t *TUI) RunWizard(fields []WizardField) (WizardResult, error)
- type TableConfig
- type TablePrinter
- func (tp *TablePrinter) AddRow(cols ...string)
- func (tp *TablePrinter) Len() int
- func (tp *TablePrinter) Render() error
- func (tp *TablePrinter) WithCellStyle(fn func(string) string) *TablePrinter
- func (tp *TablePrinter) WithHeaderStyle(fn func(string) string) *TablePrinter
- func (tp *TablePrinter) WithPrimaryStyle(fn func(string) string) *TablePrinter
- type TextField
- type TextFieldOption
- type ViewportConfig
- type ViewportModel
- func (v ViewportModel) AtBottom() bool
- func (v ViewportModel) AtTop() bool
- func (v ViewportModel) Height() int
- func (v ViewportModel) Init() tea.Cmd
- func (v ViewportModel) ScrollPercent() float64
- func (v ViewportModel) ScrollToBottom() ViewportModel
- func (v ViewportModel) ScrollToTop() ViewportModel
- func (v ViewportModel) SetContent(s string) ViewportModel
- func (v ViewportModel) SetSize(width, height int) ViewportModel
- func (v ViewportModel) SetTitle(title string) ViewportModel
- func (v ViewportModel) Title() string
- func (v ViewportModel) Update(msg tea.Msg) (ViewportModel, tea.Cmd)
- func (v ViewportModel) View() string
- func (v ViewportModel) Width() int
- type WizardField
- type WizardFieldKind
- type WizardResult
- type WizardValues
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConnectionIndicator ¶
ConnectionIndicator creates a connection status indicator.
func CounterIndicator ¶
CounterIndicator creates a counter display for the status bar.
func HelpBinding ¶
HelpBinding creates a single help binding display.
func ModeIndicator ¶
ModeIndicator creates a styled mode indicator for the status bar.
func NavigationBindings ¶
NavigationBindings returns common navigation key bindings.
func QuitBindings ¶
QuitBindings returns quit-related key bindings.
func RenderBadge ¶
RenderBadge renders text as a styled badge. If no render function is provided, uses BadgeStyle.
func RenderBytes ¶
RenderBytes renders a byte count in human-readable format.
func RenderCountBadge ¶
RenderCountBadge renders a count with a label, like "3 tasks".
func RenderDetailPanel ¶
func RenderDetailPanel(title string, pairs []KeyValuePair, width int) string
RenderDetailPanel renders a panel with key-value pairs.
func RenderDivider ¶
RenderDivider renders a horizontal divider line.
func RenderEmptyState ¶
RenderEmptyState renders a centered empty state message.
func RenderError ¶
RenderError renders an error message.
func RenderHeader ¶
func RenderHeader(cfg HeaderConfig) string
RenderHeader renders a header with title, optional subtitle, and timestamp.
func RenderHelpBar ¶
RenderHelpBar renders a help bar with the given bindings.
func RenderHelpGrid ¶
RenderHelpGrid renders bindings in a grid layout.
func RenderInfoPanel ¶
RenderInfoPanel renders a simple info panel with title and content.
func RenderKeyValueTable ¶
func RenderKeyValueTable(pairs []KeyValuePair, width int) string
RenderKeyValueTable renders a table of key-value pairs.
func RenderLabelValue ¶
RenderLabelValue renders a label-value pair.
func RenderLabeledDivider ¶
RenderLabeledDivider renders a divider with a centered label.
func RenderPercentage ¶
RenderPercentage renders a percentage value with appropriate styling.
func RenderProgress ¶
func RenderProgress(cfg ProgressConfig) string
RenderProgress renders a progress indicator. If ShowBar is true, renders a progress bar. Otherwise renders "current/total".
func RenderScrollablePanel ¶
RenderScrollablePanel renders a panel that shows scrollable content.
func RenderStatus ¶
func RenderStatus(cfg StatusConfig) string
RenderStatus renders a status indicator like "● RUNNING". Delegates to iostreams.StatusIndicator for style and symbol selection.
func RenderStatusBar ¶
RenderStatusBar is a convenience function that renders a status bar.
func RenderStatusBarWithSections ¶
func RenderStatusBarWithSections(sections []StatusBarSection, width int) string
RenderStatusBarWithSections renders a status bar with styled sections.
func RenderStepperBar ¶
RenderStepperBar renders a horizontal step indicator.
Completed steps show a checkmark icon with their title and optional value. Active steps show a filled circle icon with their title. Pending steps show an empty circle icon with their title. Skipped steps are hidden entirely.
Example output:
✓ Build Image: Yes → ◉ Flavor → ○ Submit
func RenderTag ¶
RenderTag renders a tag-like element. If no render function is provided, uses TagStyle.
func RenderTags ¶
RenderTags renders multiple tags inline. If no render function is provided, uses TagStyle.
func RunProgram ¶
func RunProgram(ios *iostreams.IOStreams, model tea.Model, opts ...ProgramOption) (tea.Model, error)
RunProgram creates and runs a BubbleTea program with the given IOStreams. It returns the final model state after the program exits.
func TimerIndicator ¶
TimerIndicator creates a timer display for the status bar.
Types ¶
type ConfirmField ¶
ConfirmField is a standalone BubbleTea model for yes/no confirmation.
func NewConfirmField ¶
func NewConfirmField(id, prompt string, defaultYes bool) ConfirmField
NewConfirmField creates a new ConfirmField with the given default value.
func (ConfirmField) BoolValue ¶
func (f ConfirmField) BoolValue() bool
BoolValue returns the boolean value of the toggle.
func (ConfirmField) Init ¶
func (f ConfirmField) Init() tea.Cmd
Init returns nil — no initial command is needed.
func (ConfirmField) IsConfirmed ¶
func (f ConfirmField) IsConfirmed() bool
IsConfirmed returns true if the user has confirmed their choice.
func (ConfirmField) SetSize ¶
func (f ConfirmField) SetSize(w, h int) ConfirmField
SetSize satisfies the wizard's updateAllFieldSizes contract. ConfirmField renders at a fixed layout, so width/height are unused.
func (ConfirmField) Update ¶
func (f ConfirmField) Update(msg tea.Msg) (ConfirmField, tea.Cmd)
Update handles key messages. Left/Right/Tab toggle the value. Enter confirms. 'y' sets true, 'n' sets false.
func (ConfirmField) Value ¶
func (f ConfirmField) Value() string
Value returns "yes" or "no" based on the current toggle state.
func (ConfirmField) View ¶
func (f ConfirmField) View() string
View renders the confirm field with prompt and [ Yes ] / [ No ] toggle.
type DashboardConfig ¶ added in v0.1.4
type DashboardConfig struct {
HelpText string // e.g., "q detach ctrl+c stop"
}
DashboardConfig configures the generic dashboard.
type DashboardRenderer ¶ added in v0.1.4
type DashboardRenderer interface {
// ProcessEvent handles a domain event received from the channel.
ProcessEvent(ev any)
// View renders the dashboard content for the given terminal width.
// Should NOT include the help line — the framework handles that.
View(cs *iostreams.ColorScheme, width int) string
}
DashboardRenderer controls the content of a channel-driven dashboard. Consumer packages implement this interface with domain-specific logic.
type DashboardResult ¶ added in v0.1.4
type DashboardResult struct {
Err error // display error only
Detached bool // user pressed q/Esc
Interrupted bool // user pressed Ctrl+C
}
DashboardResult is returned when the dashboard exits.
func RunDashboard ¶ added in v0.1.4
func RunDashboard(ios *iostreams.IOStreams, renderer DashboardRenderer, cfg DashboardConfig, ch <-chan any) DashboardResult
RunDashboard runs a generic channel-driven dashboard. Events are read from ch and dispatched to renderer.ProcessEvent(). Returns when the channel is closed or the user presses q/Esc/Ctrl+C.
type FieldOption ¶
FieldOption represents a selectable option with a label and description.
type HeaderConfig ¶
HeaderConfig configures a header component.
type HelpConfig ¶
type HelpConfig struct {
Width int
ShowAll bool // Show all bindings vs short help
Separator string
}
HelpConfig configures the help bar component.
func DefaultHelpConfig ¶
func DefaultHelpConfig() HelpConfig
DefaultHelpConfig returns sensible defaults for a help bar.
type HelpModel ¶
type HelpModel struct {
// contains filtered or unexported fields
}
HelpModel represents a help bar showing key bindings.
func NewHelp ¶
func NewHelp(cfg HelpConfig) HelpModel
NewHelp creates a new help bar with the given configuration.
func (HelpModel) SetBindings ¶
SetBindings sets the key bindings to display.
func (HelpModel) SetSeparator ¶
SetSeparator sets the separator between bindings.
func (HelpModel) SetShowAll ¶
SetShowAll sets whether to show all bindings.
type HookResult ¶
type HookResult struct {
Continue bool // false = quit execution
Message string // reason for quitting (only meaningful when Continue=false)
Err error // hook's own failure (independent of Continue)
}
HookResult controls execution flow after a lifecycle hook fires.
type KeyMap ¶
type KeyMap struct {
Quit key.Binding
Up key.Binding
Down key.Binding
Left key.Binding
Right key.Binding
Enter key.Binding
Escape key.Binding
Help key.Binding
Tab key.Binding
}
KeyMap defines common key bindings used across TUI components.
type KeyValuePair ¶
KeyValuePair represents a key-value pair for display.
type LifecycleHook ¶
type LifecycleHook func(component, event string) HookResult
LifecycleHook is called at key moments during TUI component execution. component identifies the source (e.g., "progress"), event names the moment (e.g., "before_complete"). Implementations may block (for pausing) or return quickly (for logging). nil hooks are never called — components check before firing.
type ListConfig ¶
ListConfig configures a list component.
func DefaultListConfig ¶
func DefaultListConfig() ListConfig
DefaultListConfig returns sensible defaults for a list.
type ListItem ¶
type ListItem interface {
// Title returns the main display text.
Title() string
// Description returns optional secondary text.
Description() string
// FilterValue returns the string used for filtering.
FilterValue() string
}
ListItem represents an item that can be displayed in a list.
type ListModel ¶
type ListModel struct {
// contains filtered or unexported fields
}
ListModel is a lightweight selectable list component.
func NewList ¶
func NewList(cfg ListConfig) ListModel
NewList creates a new list with the given configuration.
func (ListModel) SelectFirst ¶
SelectFirst moves selection to the first item.
func (ListModel) SelectLast ¶
SelectLast moves selection to the last item.
func (ListModel) SelectNext ¶
SelectNext moves selection to the next item.
func (ListModel) SelectPrev ¶
SelectPrev moves selection to the previous item.
func (ListModel) SelectedIndex ¶
SelectedIndex returns the index of the selected item.
func (ListModel) SelectedItem ¶
SelectedItem returns the currently selected item, or nil if empty.
func (ListModel) SetShowDescriptions ¶
SetShowDescriptions sets whether to show descriptions.
type PanelConfig ¶
PanelConfig configures a panel component.
func DefaultPanelConfig ¶
func DefaultPanelConfig() PanelConfig
DefaultPanelConfig returns sensible defaults for a panel.
type PanelGroup ¶
type PanelGroup struct {
// contains filtered or unexported fields
}
PanelGroup manages a group of panels with focus handling.
func NewPanelGroup ¶
func NewPanelGroup(panels ...PanelModel) PanelGroup
NewPanelGroup creates a new panel group.
func (PanelGroup) Add ¶
func (g PanelGroup) Add(panel PanelModel) PanelGroup
Add adds a panel to the group.
func (PanelGroup) Focus ¶
func (g PanelGroup) Focus(index int) PanelGroup
Focus sets focus to a specific panel index.
func (PanelGroup) FocusNext ¶
func (g PanelGroup) FocusNext() PanelGroup
FocusNext moves focus to the next panel.
func (PanelGroup) FocusPrev ¶
func (g PanelGroup) FocusPrev() PanelGroup
FocusPrev moves focus to the previous panel.
func (PanelGroup) FocusedIndex ¶
func (g PanelGroup) FocusedIndex() int
FocusedIndex returns the index of the focused panel.
func (PanelGroup) FocusedPanel ¶
func (g PanelGroup) FocusedPanel() PanelModel
FocusedPanel returns the currently focused panel.
func (PanelGroup) Panels ¶
func (g PanelGroup) Panels() []PanelModel
Panels returns all panels in the group.
func (PanelGroup) RenderHorizontal ¶
func (g PanelGroup) RenderHorizontal(gap int) string
RenderHorizontal renders panels in a horizontal row.
func (PanelGroup) RenderVertical ¶
func (g PanelGroup) RenderVertical(gap int) string
RenderVertical renders panels in a vertical stack.
type PanelModel ¶
type PanelModel struct {
// contains filtered or unexported fields
}
PanelModel represents a bordered content container.
func NewPanel ¶
func NewPanel(cfg PanelConfig) PanelModel
NewPanel creates a new panel with the given configuration.
func (PanelModel) Content ¶
func (p PanelModel) Content() string
Content returns the panel's content.
func (PanelModel) IsFocused ¶
func (p PanelModel) IsFocused() bool
IsFocused returns whether the panel is focused.
func (PanelModel) SetContent ¶
func (p PanelModel) SetContent(content string) PanelModel
SetContent sets the panel's content.
func (PanelModel) SetFocused ¶
func (p PanelModel) SetFocused(focused bool) PanelModel
SetFocused sets whether the panel is focused.
func (PanelModel) SetHeight ¶
func (p PanelModel) SetHeight(height int) PanelModel
SetHeight sets the panel's height.
func (PanelModel) SetPadding ¶
func (p PanelModel) SetPadding(padding int) PanelModel
SetPadding sets the panel's internal padding.
func (PanelModel) SetTitle ¶
func (p PanelModel) SetTitle(title string) PanelModel
SetTitle sets the panel's title.
func (PanelModel) SetWidth ¶
func (p PanelModel) SetWidth(width int) PanelModel
SetWidth sets the panel's width.
type ProgramOption ¶
type ProgramOption func(*programOptions)
ProgramOption configures a BubbleTea program.
func WithAltScreen ¶
func WithAltScreen(enabled bool) ProgramOption
WithAltScreen enables or disables the alternate screen buffer.
func WithMouseMotion ¶
func WithMouseMotion(enabled bool) ProgramOption
WithMouseMotion enables or disables mouse motion events.
type ProgressConfig ¶
ProgressConfig configures a progress indicator.
type ProgressDisplayConfig ¶
type ProgressDisplayConfig struct {
Title string // e.g., "Building"
Subtitle string // e.g., image tag
CompletionVerb string // Success summary verb (e.g., "Built", "Deployed"). Default: "Completed"
MaxVisible int // per-stage child window size (default: 5)
LogLines int // per-step log buffer capacity (default: 3)
// Callbacks — all optional. nil = passthrough / no-op.
IsInternal func(string) bool // filter function (nil = show all)
CleanName func(string) string // name cleaning (nil = passthrough)
ParseGroup func(string) string // group/stage detection (nil = no groups)
FormatDuration func(time.Duration) string // duration formatting (nil = default)
// Lifecycle hook — called at key moments. nil = no-op.
OnLifecycle LifecycleHook
// AltScreen enables the alternate screen buffer for TTY mode.
// When true, progress output is rendered in the alt screen and cleared
// when the display finishes — useful for clean handoff to a container TTY.
AltScreen bool
}
ProgressDisplayConfig configures the progress display. Domain-specific logic flows in through callbacks — the display itself has zero knowledge of what is being tracked.
type ProgressResult ¶
type ProgressResult struct {
Err error // only set if the progress display itself errors
}
ProgressResult contains the outcome of a progress display.
func RunProgress ¶
func RunProgress(ios *iostreams.IOStreams, mode string, cfg ProgressDisplayConfig, ch <-chan ProgressStep) ProgressResult
RunProgress runs a progress display, consuming steps from ch until it is closed. It selects TTY (BubbleTea) or plain mode based on the terminal and mode setting. The mode parameter can be "auto", "plain", or "tty". Channel closure signals completion — the caller closes ch when done.
type ProgressStep ¶
type ProgressStep struct {
ID string
Name string
Status ProgressStepStatus
LogLine string
Cached bool
Error string
}
ProgressStep represents a single progress update from the pipeline. The caller sends these on a channel consumed by RunProgress.
type ProgressStepStatus ¶
type ProgressStepStatus int
ProgressStepStatus represents the state of a progress step.
const ( StepPending ProgressStepStatus = iota StepRunning StepComplete StepCached StepError )
type SelectField ¶
type SelectField struct {
ID string
Prompt string
Options []FieldOption
// contains filtered or unexported fields
}
SelectField is a standalone BubbleTea model for arrow-key selection. It wraps ListModel for navigation state but renders its own compact view with label + description on a single line.
func NewSelectField ¶
func NewSelectField(id, prompt string, options []FieldOption, defaultIdx int) SelectField
NewSelectField creates a new SelectField with the given options. defaultIdx sets the initially selected option (clamped to valid range).
func (SelectField) Init ¶
func (f SelectField) Init() tea.Cmd
Init returns nil — no initial command is needed.
func (SelectField) IsConfirmed ¶
func (f SelectField) IsConfirmed() bool
IsConfirmed returns true if the user has confirmed their selection.
func (SelectField) SelectedIndex ¶
func (f SelectField) SelectedIndex() int
SelectedIndex returns the index of the currently selected option.
func (SelectField) SetSize ¶
func (f SelectField) SetSize(w, h int) SelectField
SetSize sets the width and height available for rendering.
func (SelectField) Update ¶
func (f SelectField) Update(msg tea.Msg) (SelectField, tea.Cmd)
Update handles key messages. Up/Down delegate to the internal list. Enter confirms the selection and sends tea.Quit for standalone use.
func (SelectField) Value ¶
func (f SelectField) Value() string
Value returns the label of the currently selected option.
func (SelectField) View ¶
func (f SelectField) View() string
View renders the select field with prompt and compact option list. Each option shows label and description on one line:
> bookworm Debian stable (Recommended) trixie Debian testing
type SimpleListItem ¶
SimpleListItem is a basic implementation of ListItem.
func (SimpleListItem) Description ¶
func (i SimpleListItem) Description() string
Description implements ListItem.
func (SimpleListItem) FilterValue ¶
func (i SimpleListItem) FilterValue() string
FilterValue implements ListItem.
type SpinnerModel ¶
type SpinnerModel struct {
// contains filtered or unexported fields
}
SpinnerModel is a wrapper around bubbles/spinner with clawker styling.
func NewDefaultSpinner ¶
func NewDefaultSpinner(label string) SpinnerModel
NewDefaultSpinner creates a spinner with default settings.
func NewSpinner ¶
func NewSpinner(spinnerType SpinnerType, label string) SpinnerModel
NewSpinner creates a new spinner with the specified type and label.
func (SpinnerModel) SetLabel ¶
func (m SpinnerModel) SetLabel(label string) SpinnerModel
SetLabel updates the spinner's label.
func (SpinnerModel) SetSpinnerType ¶
func (m SpinnerModel) SetSpinnerType(t SpinnerType) SpinnerModel
SetSpinnerType changes the spinner animation type.
func (SpinnerModel) Tick ¶
func (m SpinnerModel) Tick() tea.Msg
Tick returns a command to tick the spinner.
func (SpinnerModel) Update ¶
func (m SpinnerModel) Update(msg tea.Msg) (SpinnerModel, tea.Cmd)
Update handles messages for the spinner.
type SpinnerTickMsg ¶
SpinnerTickMsg is sent when the spinner should update.
type SpinnerType ¶
type SpinnerType int
SpinnerType defines the animation style for a spinner.
const ( SpinnerDots SpinnerType = iota SpinnerLine SpinnerMiniDots SpinnerJump SpinnerPulse SpinnerPoints SpinnerGlobe SpinnerMoon SpinnerMonkey )
type StatusBarModel ¶
type StatusBarModel struct {
// contains filtered or unexported fields
}
StatusBarModel represents a single-line status bar with left/center/right sections.
func NewStatusBar ¶
func NewStatusBar(width int) StatusBarModel
NewStatusBar creates a new status bar with the given width.
func (StatusBarModel) Center ¶
func (m StatusBarModel) Center() string
Center returns the center section content.
func (StatusBarModel) Left ¶
func (m StatusBarModel) Left() string
Left returns the left section content.
func (StatusBarModel) Right ¶
func (m StatusBarModel) Right() string
Right returns the right section content.
func (StatusBarModel) SetCenter ¶
func (m StatusBarModel) SetCenter(s string) StatusBarModel
SetCenter sets the center section content.
func (StatusBarModel) SetLeft ¶
func (m StatusBarModel) SetLeft(s string) StatusBarModel
SetLeft sets the left section content.
func (StatusBarModel) SetRight ¶
func (m StatusBarModel) SetRight(s string) StatusBarModel
SetRight sets the right section content.
func (StatusBarModel) SetWidth ¶
func (m StatusBarModel) SetWidth(width int) StatusBarModel
SetWidth sets the status bar width.
func (StatusBarModel) Width ¶
func (m StatusBarModel) Width() int
Width returns the status bar width.
type StatusBarSection ¶
StatusBarSection represents a styled section of the status bar.
type StatusConfig ¶
StatusConfig configures a status indicator.
type Step ¶
type Step struct {
Title string // Short label for the bar
Value string // Displayed next to completed steps (e.g., "bookworm")
State StepState
}
Step represents a single step in a stepper bar.
type StepState ¶
type StepState int
StepState represents the state of a step in a stepper bar.
const ( // StepPendingState indicates the step has not been started. StepPendingState StepState = iota // StepActiveState indicates the step is currently active. StepActiveState // StepCompleteState indicates the step has been completed. StepCompleteState // StepSkippedState indicates the step was skipped (hidden from display). StepSkippedState )
type TUI ¶
type TUI struct {
// contains filtered or unexported fields
}
TUI provides the interactive presentation layer. Constructed once via Factory; hooks registered separately after construction. This enables pointer-sharing: commands capture *TUI eagerly at NewCmd time, while hooks are registered later (e.g., in PersistentPreRunE after flag parsing).
func (*TUI) IOStreams ¶
IOStreams returns the underlying IOStreams for callers that need direct access.
func (*TUI) NewTable ¶
func (t *TUI) NewTable(headers ...string) *TablePrinter
NewTable creates a TablePrinter bound to this TUI's IOStreams.
func (*TUI) RegisterHooks ¶
func (t *TUI) RegisterHooks(hooks ...LifecycleHook)
RegisterHooks appends one or more lifecycle hooks. Hooks fire in registration order; the first non-continue result short-circuits.
func (*TUI) RunProgress ¶
func (t *TUI) RunProgress(mode string, cfg ProgressDisplayConfig, ch <-chan ProgressStep) ProgressResult
RunProgress displays a multi-step progress view, delegating to the package-level RunProgress function. Registered hooks are injected into cfg.OnLifecycle if the caller has not already set one.
func (*TUI) RunWizard ¶
func (t *TUI) RunWizard(fields []WizardField) (WizardResult, error)
RunWizard runs a multi-step wizard using the given field definitions. Returns the collected values and whether the wizard was submitted (vs cancelled).
type TableConfig ¶
RenderTable renders a simple table with headers and rows.
type TablePrinter ¶
type TablePrinter struct {
// contains filtered or unexported fields
}
TablePrinter renders tabular data with TTY-aware styling. In styled mode (TTY + color), delegates to iostreams.RenderStyledTable (lipgloss/table). In plain mode (non-TTY/piped), uses text/tabwriter for machine-friendly output.
func (*TablePrinter) AddRow ¶
func (tp *TablePrinter) AddRow(cols ...string)
AddRow appends a data row. Missing columns are padded with empty strings; extra columns beyond the header count are discarded.
func (*TablePrinter) Len ¶
func (tp *TablePrinter) Len() int
Len returns the number of data rows (excluding the header).
func (*TablePrinter) Render ¶
func (tp *TablePrinter) Render() error
Render writes the table to ios.Out. Returns nil if there are no headers.
func (*TablePrinter) WithCellStyle ¶
func (tp *TablePrinter) WithCellStyle(fn func(string) string) *TablePrinter
WithCellStyle overrides the default cell style. The function receives cell text and returns styled text. Pass nil to use the default (plain with padding).
func (*TablePrinter) WithHeaderStyle ¶
func (tp *TablePrinter) WithHeaderStyle(fn func(string) string) *TablePrinter
WithHeaderStyle overrides the header row style. The function receives cell text and returns styled text. Pass nil to use the default (TableHeaderStyle).
func (*TablePrinter) WithPrimaryStyle ¶
func (tp *TablePrinter) WithPrimaryStyle(fn func(string) string) *TablePrinter
WithPrimaryStyle overrides the first-column style. The function receives cell text and returns styled text. Pass nil to use the default (TablePrimaryColumnStyle).
type TextField ¶
TextField is a standalone BubbleTea model for text input. It wraps the bubbles textinput component with validation support.
func NewTextField ¶
func NewTextField(id, prompt string, opts ...TextFieldOption) TextField
NewTextField creates a new TextField with the given options.
func (TextField) IsConfirmed ¶
IsConfirmed returns true if the user has confirmed the input.
func (TextField) Update ¶
Update handles key messages. Enter validates and confirms. All other keys are delegated to the underlying textinput.
type TextFieldOption ¶
type TextFieldOption func(*TextField)
TextFieldOption is a functional option for configuring a TextField.
func WithDefault ¶
func WithDefault(s string) TextFieldOption
WithDefault sets the initial value of the text input.
func WithPlaceholder ¶
func WithPlaceholder(s string) TextFieldOption
WithPlaceholder sets the placeholder text shown when the input is empty.
func WithRequired ¶
func WithRequired() TextFieldOption
WithRequired marks the field as required — an empty value is rejected on Enter.
func WithValidator ¶
func WithValidator(fn func(string) error) TextFieldOption
WithValidator sets a validation function called on Enter. If the function returns an error, the field displays it and does not confirm.
type ViewportConfig ¶
ViewportConfig configures a viewport component.
type ViewportModel ¶
type ViewportModel struct {
// contains filtered or unexported fields
}
ViewportModel wraps a bubbles viewport with consistent styling. It provides scrollable content within a bordered panel.
func NewViewport ¶
func NewViewport(cfg ViewportConfig) ViewportModel
NewViewport creates a new viewport with the given configuration.
func (ViewportModel) AtBottom ¶
func (v ViewportModel) AtBottom() bool
AtBottom returns true if the viewport is scrolled to the bottom.
func (ViewportModel) AtTop ¶
func (v ViewportModel) AtTop() bool
AtTop returns true if the viewport is scrolled to the top.
func (ViewportModel) Height ¶
func (v ViewportModel) Height() int
Height returns the viewport height.
func (ViewportModel) ScrollPercent ¶
func (v ViewportModel) ScrollPercent() float64
ScrollPercent returns the scroll position as a percentage (0.0 to 1.0).
func (ViewportModel) ScrollToBottom ¶
func (v ViewportModel) ScrollToBottom() ViewportModel
ScrollToBottom scrolls to the bottom of the content.
func (ViewportModel) ScrollToTop ¶
func (v ViewportModel) ScrollToTop() ViewportModel
ScrollToTop scrolls to the top of the content.
func (ViewportModel) SetContent ¶
func (v ViewportModel) SetContent(s string) ViewportModel
SetContent sets the viewport content.
func (ViewportModel) SetSize ¶
func (v ViewportModel) SetSize(width, height int) ViewportModel
SetSize sets the viewport dimensions.
func (ViewportModel) SetTitle ¶
func (v ViewportModel) SetTitle(title string) ViewportModel
SetTitle sets the viewport title.
func (ViewportModel) Title ¶
func (v ViewportModel) Title() string
Title returns the viewport title.
func (ViewportModel) Update ¶
func (v ViewportModel) Update(msg tea.Msg) (ViewportModel, tea.Cmd)
Update implements tea.Model.
type WizardField ¶
type WizardField struct {
ID string
Title string // StepperBar label
Prompt string // Question text
Kind WizardFieldKind
// Select-specific fields.
Options []FieldOption
DefaultIdx int
// Text-specific fields.
Placeholder string
Default string
Validator func(string) error
Required bool
// Confirm-specific fields.
DefaultYes bool
// Conditional: skip this step when predicate returns true.
SkipIf func(WizardValues) bool
}
WizardField defines a single step in the wizard.
type WizardFieldKind ¶
type WizardFieldKind int
WizardFieldKind identifies the type of field in a wizard step.
const ( // FieldSelect is an arrow-key selection field. FieldSelect WizardFieldKind = iota // FieldText is a text input field. FieldText // FieldConfirm is a yes/no confirmation field. FieldConfirm )
func (WizardFieldKind) String ¶
func (k WizardFieldKind) String() string
String returns a debug-friendly name for WizardFieldKind.
type WizardResult ¶
type WizardResult struct {
Values WizardValues
Submitted bool
}
WizardResult is returned by RunWizard.
type WizardValues ¶
WizardValues is a map of field ID to string value.