ui

package
v1.0.48254 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 14, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const MarkdownViewportFooterHeight = components.PagerFooterHeight

MarkdownViewportFooterHeight is the number of rows reserved below the viewport for the footer (one blank separator row + the help line). Callers use it to decide whether content fits on one screen.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfirmModel

type ConfirmModel struct {
	// contains filtered or unexported fields
}

ConfirmModel is a bubbletea model for a y/N confirmation prompt. Press y/Y to confirm, n/N/esc/ctrl+c to decline.

func NewConfirmModel

func NewConfirmModel(prompt string) ConfirmModel

func (ConfirmModel) Confirmed

func (m ConfirmModel) Confirmed() bool

func (ConfirmModel) Done

func (m ConfirmModel) Done() bool

func (ConfirmModel) Init

func (m ConfirmModel) Init() tea.Cmd

func (ConfirmModel) Update

func (m ConfirmModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (ConfirmModel) View

func (m ConfirmModel) View() tea.View

type MarkdownViewportModel

type MarkdownViewportModel struct {
	// contains filtered or unexported fields
}

MarkdownViewportModel is a full-screen pager for rendered markdown. It is a thin host around components.PagerModel (which provides the scrollable viewport, less-style "/" search and footer), adding the markdown-specific bindings: q and esc quit, and esc first dismisses an active search.

Content is produced by a render callback so the markdown can be re-wrapped to the live terminal width whenever the window is resized.

func NewMarkdownViewportModel

func NewMarkdownViewportModel(render func(width int) string) MarkdownViewportModel

NewMarkdownViewportModel returns a pager that displays the markdown produced by render. render is given the column width the content must fit into and is re-invoked on every resize so the markdown re-wraps.

func (MarkdownViewportModel) Init

func (m MarkdownViewportModel) Init() tea.Cmd

func (MarkdownViewportModel) Update

func (m MarkdownViewportModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (MarkdownViewportModel) View

func (m MarkdownViewportModel) View() tea.View

type PromptModel

type PromptModel struct {
	// contains filtered or unexported fields
}

PromptModel is a bubbletea model for prompting a single line of plain (non-secret) text. Esc / Ctrl+C cancel. Enter confirms.

func NewPromptModel

func NewPromptModel(header, placeholder, defaultVal string) PromptModel

NewPromptModel creates a PromptModel with the given header, an optional placeholder shown inside the empty input field, and an optional default value accepted when the user presses Enter with an empty field.

func (PromptModel) Init

func (m PromptModel) Init() tea.Cmd

func (PromptModel) Quitting

func (m PromptModel) Quitting() bool

Quitting reports whether the user pressed Esc or Ctrl+C without confirming.

func (PromptModel) Update

func (m PromptModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (PromptModel) Value

func (m PromptModel) Value() string

Value returns the entered text.

func (PromptModel) View

func (m PromptModel) View() tea.View

type SecretModel

type SecretModel struct {
	// contains filtered or unexported fields
}

SecretModel is a bubbletea model for prompting a secret value. Input is masked (echo password mode). The prompt header is configurable so callers can name the specific secret being requested.

func NewSecretModel

func NewSecretModel(header string) SecretModel

NewSecretModel creates a SecretModel with the given header text.

func (SecretModel) Init

func (m SecretModel) Init() tea.Cmd

func (SecretModel) Quitting

func (m SecretModel) Quitting() bool

Quitting reports whether the user pressed Esc or Ctrl+C.

func (SecretModel) Update

func (m SecretModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (SecretModel) Value

func (m SecretModel) Value() string

Value returns the entered secret value.

func (SecretModel) View

func (m SecretModel) View() tea.View

type SelectModel

type SelectModel struct {
	// contains filtered or unexported fields
}

SelectModel is a top-level bubbletea model that wraps components.SelectModel and quits the program on selection or cancellation.

func NewSelectModel

func NewSelectModel(prompt string, options []string) SelectModel

NewSelectModel creates a standalone select prompt. options is the list of choices to display.

func (SelectModel) Cancelled

func (m SelectModel) Cancelled() bool

Cancelled reports whether the user quit without selecting.

func (SelectModel) Init

func (m SelectModel) Init() tea.Cmd

func (SelectModel) Selected

func (m SelectModel) Selected() int

Selected returns the index of the chosen option. Only valid when !Cancelled().

func (SelectModel) Update

func (m SelectModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (SelectModel) View

func (m SelectModel) View() tea.View

func (SelectModel) WithCursor

func (m SelectModel) WithCursor(i int) SelectModel

WithCursor returns a copy of the model with the initial highlighted option set to index i. Use this to pre-select a default choice.

type SpinnerModel

type SpinnerModel struct {
	// contains filtered or unexported fields
}

SpinnerModel is a bubbletea model that displays an animated spinner with a message. Run it in a goroutine via tea.NewProgram; call p.Quit() to stop it.

func NewSpinnerModel

func NewSpinnerModel(msg string, color bool) SpinnerModel

func (SpinnerModel) Init

func (m SpinnerModel) Init() tea.Cmd

func (SpinnerModel) Update

func (m SpinnerModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (SpinnerModel) View

func (m SpinnerModel) View() tea.View

type ThemePickerModel

type ThemePickerModel struct {
	// contains filtered or unexported fields
}

ThemePickerModel is a top-level bubbletea program that splits the screen horizontally: the left pane is the standard select list of theme names, and the right pane shows sample markdown rendered in the currently-highlighted theme. Moving the cursor re-renders the preview, so the user sees each theme applied live before committing. Enter confirms; Esc/Ctrl+C cancels.

The markdown is produced by a render callback so the program stays decoupled from glamour: the caller (iostream) supplies a closure that renders the sample in a given theme, wrapped to a given width.

func NewThemePickerModel

func NewThemePickerModel(prompt string, labels, themes []string, render func(theme string, width int) string, color, animate bool) ThemePickerModel

NewThemePickerModel builds a theme picker. labels are the display strings for the list (e.g. with a "(default)" marker); themes are the matching raw theme names, same length and order. render produces the preview markdown for a theme at a given width. animate reports whether the loading spinner should be animated. Pass false when CIRCLE_SPINNER_DISABLED is set or output is non-interactive, so the placeholder stays static.

func (ThemePickerModel) Cancelled

func (m ThemePickerModel) Cancelled() bool

Cancelled reports whether the user quit without selecting.

func (ThemePickerModel) Init

func (m ThemePickerModel) Init() tea.Cmd

Init starts the spinner ticking so the loading placeholder animates. The spinner self-schedules its next tick, so a single Tick here keeps it running for the lifetime of the program. When animation is disabled it stays still, so scripted or non-TTY sessions see a stable screen.

func (ThemePickerModel) Selected

func (m ThemePickerModel) Selected() int

Selected returns the index of the chosen theme. Only valid when !Cancelled().

func (ThemePickerModel) Update

func (m ThemePickerModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (ThemePickerModel) View

func (m ThemePickerModel) View() tea.View

func (ThemePickerModel) WithCursor

func (m ThemePickerModel) WithCursor(i int) ThemePickerModel

WithCursor returns a copy with the initial highlighted option at index i. Use this to start on the current theme.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL