ui

package
v1.9.3-0...-199195a Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2026 License: MIT Imports: 15 Imported by: 0

README

ui

import "github.com/tagoro9/fotingo/internal/ui"

Package ui provides reusable Bubble Tea primitives shared across interactive commands.

Package ui provides reusable Bubble Tea UI components for the fotingo CLI.

Index

Variables

ErrEditorEmpty is returned when the editor content is empty.

var ErrEditorEmpty = errors.New(i18n.T(i18n.UIErrEditorEmpty))

ErrEditorFailed is returned when the editor exits with an error.

var ErrEditorFailed = errors.New(i18n.T(i18n.UIErrEditorFailed))

ErrNoEditor is returned when no editor is available.

var ErrNoEditor = errors.New(i18n.T(i18n.UIErrNoEditor))

Icons provides consistent unicode icons for UI elements.

var Icons = struct {
    // Issue type icons
    Bug         string
    Story       string
    Task        string
    Epic        string
    Subtask     string
    Improvement string
    NewFeature  string
    Unknown     string

    // Status icons
    Check    string
    Cross    string
    Warning  string
    Info     string
    Question string

    // UI icons
    Cursor    string
    Checkbox  string
    Selected  string
    Arrow     string
    Spinner   string
    Ellipsis  string
    Separator string
}{

    Bug:         "[B]",
    Story:       "[S]",
    Task:        "[T]",
    Epic:        "[E]",
    Subtask:     "[s]",
    Improvement: "[I]",
    NewFeature:  "[N]",
    Unknown:     "[?]",

    Check:    "[v]",
    Cross:    "[x]",
    Warning:  "[!]",
    Info:     "[i]",
    Question: "[?]",

    Cursor:    ">",
    Checkbox:  "[ ]",
    Selected:  "[x]",
    Arrow:     "->",
    Spinner:   "*",
    Ellipsis:  "...",
    Separator: "|",
}

Spacing provides consistent spacing values.

var Spacing = struct {
    None   int
    Small  int
    Medium int
    Large  int
}{
    None:   0,
    Small:  1,
    Medium: 2,
    Large:  4,
}

func Confirm

func Confirm(prompt string, defaultYes bool) (bool, error)

Confirm is a helper function to show a confirmation prompt and return the result.

func GetEditor

func GetEditor() string

GetEditor returns the path to the editor command.

func HasEditor

func HasEditor() bool

HasEditor returns true if an editor is available.

func IssueTypeIcon

func IssueTypeIcon(issueType string) string

IssueTypeIcon returns the appropriate icon for a Jira issue type.

func OpenEditor

func OpenEditor(initialContent string) (string, error)

OpenEditor is a convenience function to open an editor with content and return the result.

func OpenEditorOrFallback

func OpenEditorOrFallback(initialContent string, fallback string) string

OpenEditorOrFallback opens an editor if available, otherwise returns the fallback content.

func OpenEditorWithConfig

func OpenEditorWithConfig(config EditorConfig) (string, error)

OpenEditorWithConfig is a convenience function to open an editor with custom config.

func RenderStaticSpinner

func RenderStaticSpinner(message string, completed bool, err error) string

RenderStaticSpinner renders a non-animated spinner view for non-TTY output.

func SelectIDs

func SelectIDs(title string, items []MultiSelectItem, minimum int) ([]string, error)

SelectIDs renders a shared multi-select prompt and returns selected item IDs.

func SetProgramRunner

func SetProgramRunner(runner func(run func() error) error)

SetProgramRunner configures an optional wrapper for interactive TUI program execution. Passing nil resets to direct execution.

type BrowserProgram

BrowserProgram provides a list/detail interactive browser experience. Enter opens details for the selected item. Escape goes back to the list. Escape on the list exits the browser.

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

func NewBrowserProgram
func NewBrowserProgram(title string, items []PickerItem, renderDetail func(PickerItem) string) *BrowserProgram

NewBrowserProgram creates a browser program for list/detail navigation.

func (*BrowserProgram) Run
func (bp *BrowserProgram) Run() error

Run executes the browser program.

type ColorScheme

ColorScheme defines the color palette for UI components.

type ColorScheme struct {
    // Primary colors
    Primary   lipgloss.TerminalColor
    Secondary lipgloss.TerminalColor
    Accent    lipgloss.TerminalColor

    // Status colors
    Success lipgloss.TerminalColor
    Warning lipgloss.TerminalColor
    Error   lipgloss.TerminalColor
    Info    lipgloss.TerminalColor

    // UI colors
    Border     lipgloss.TerminalColor
    Muted      lipgloss.TerminalColor
    Background lipgloss.TerminalColor
    Foreground lipgloss.TerminalColor

    // Selection colors
    Selected   lipgloss.TerminalColor
    Unselected lipgloss.TerminalColor
    Cursor     lipgloss.TerminalColor
}

func DarkScheme
func DarkScheme() ColorScheme

DarkScheme returns the color scheme for dark terminals.

func DefaultScheme
func DefaultScheme() ColorScheme

DefaultScheme returns the appropriate color scheme based on terminal settings. It respects NO_COLOR environment variable.

func LightScheme
func LightScheme() ColorScheme

LightScheme returns the color scheme for light terminals.

type ConfirmModel

ConfirmModel represents a y/n confirmation prompt.

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

func NewConfirm
func NewConfirm(opts ...ConfirmOption) ConfirmModel

NewConfirm creates a new ConfirmModel.

func (ConfirmModel) Cancelled
func (m ConfirmModel) Cancelled() bool

Cancelled returns whether the prompt was cancelled.

func (ConfirmModel) Confirmed
func (m ConfirmModel) Confirmed() bool

Confirmed returns whether Yes was selected.

func (ConfirmModel) Init
func (m ConfirmModel) Init() tea.Cmd

Init initializes the confirmation model.

func (ConfirmModel) Selected
func (m ConfirmModel) Selected() bool

Selected returns the current selection (true = Yes, false = No).

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

Update handles messages for the confirmation model.

func (ConfirmModel) View
func (m ConfirmModel) View() string

View renders the confirmation prompt.

type ConfirmOption

ConfirmOption configures a ConfirmModel.

type ConfirmOption func(*ConfirmModel)

func WithConfirmPrompt
func WithConfirmPrompt(prompt string) ConfirmOption

WithConfirmPrompt sets the confirmation prompt text.

func WithConfirmStyles
func WithConfirmStyles(styles Styles) ConfirmOption

WithConfirmStyles sets custom styles for the confirmation.

func WithDefaultNo
func WithDefaultNo() ConfirmOption

WithDefaultNo sets the default selection to No.

func WithDefaultYes
func WithDefaultYes() ConfirmOption

WithDefaultYes sets the default selection to Yes.

func WithShowButtons
func WithShowButtons() ConfirmOption

WithShowButtons enables button-style display.

type ConfirmProgram

ConfirmProgram wraps a ConfirmModel in a tea.Program for standalone use.

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

func NewConfirmProgram
func NewConfirmProgram(opts ...ConfirmOption) *ConfirmProgram

NewConfirmProgram creates a new confirmation program for standalone operation.

func (*ConfirmProgram) Run
func (cp *ConfirmProgram) Run() (confirmed bool, cancelled bool, err error)

Run runs the confirmation program and returns the result.

type ConfirmResultMsg

ConfirmResultMsg is sent when the confirmation is resolved.

type ConfirmResultMsg struct {
    Confirmed bool
    Cancelled bool
}

type Editor

Editor provides functionality to open an external editor.

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

func NewEditor
func NewEditor(config EditorConfig) (*Editor, error)

NewEditor creates a new Editor instance.

func (*Editor) Edit
func (e *Editor) Edit() (string, error)

Edit opens the editor with the initial content and returns the edited content.

func (*Editor) FilePath
func (e *Editor) FilePath() string

FilePath returns the path of the temp file (useful if DeleteOnClose is false).

type EditorConfig

EditorConfig configures the editor behavior.

type EditorConfig struct {
    // Extension is the file extension for the temp file (default: ".md")
    Extension string

    // InitialContent is the initial content to show in the editor
    InitialContent string

    // Prefix is a prefix for the temp file name
    Prefix string

    // AllowEmpty if true, allows empty content to be returned
    AllowEmpty bool

    // DeleteOnClose if true, deletes the temp file after editing
    DeleteOnClose bool
}

func DefaultEditorConfig
func DefaultEditorConfig() EditorConfig

DefaultEditorConfig returns the default editor configuration.

type InputCancelMsg

InputCancelMsg is sent when the input is cancelled.

type InputCancelMsg struct{}

type InputModel

InputModel represents a styled text input with validation support.

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

func NewInput
func NewInput(opts ...InputOption) InputModel

NewInput creates a new InputModel.

func (*InputModel) Blur
func (m *InputModel) Blur()

Blur removes focus from the input.

func (InputModel) Cancelled
func (m InputModel) Cancelled() bool

Cancelled returns whether the input was cancelled.

func (InputModel) Error
func (m InputModel) Error() error

Error returns any validation error.

func (*InputModel) Focus
func (m *InputModel) Focus() tea.Cmd

Focus focuses the input.

func (InputModel) Init
func (m InputModel) Init() tea.Cmd

Init initializes the input model.

func (*InputModel) Reset
func (m *InputModel) Reset()

Reset resets the input state.

func (*InputModel) SetValue
func (m *InputModel) SetValue(value string)

SetValue sets the input value.

func (InputModel) Submitted
func (m InputModel) Submitted() bool

Submitted returns whether the input was submitted.

func (InputModel) Update
func (m InputModel) Update(msg tea.Msg) (InputModel, tea.Cmd)

Update handles messages for the input model.

func (InputModel) Value
func (m InputModel) Value() string

Value returns the current input value.

func (InputModel) View
func (m InputModel) View() string

View renders the input.

type InputOption

InputOption configures an InputModel.

type InputOption func(*InputModel)

func WithCharLimit
func WithCharLimit(limit int) InputOption

WithCharLimit sets the character limit.

func WithInitialValue
func WithInitialValue(value string) InputOption

WithInitialValue sets the initial input value.

func WithInputStyles
func WithInputStyles(styles Styles) InputOption

WithInputStyles sets custom styles for the input.

func WithMasked
func WithMasked() InputOption

WithMasked enables password masking mode.

func WithMultiline
func WithMultiline(height int) InputOption

WithMultiline enables wrapped multiline input.

func WithPlaceholder
func WithPlaceholder(placeholder string) InputOption

WithPlaceholder sets the placeholder text.

func WithPrompt
func WithPrompt(prompt string) InputOption

WithPrompt sets the input prompt text.

func WithValidation
func WithValidation(fn ValidationFunc) InputOption

WithValidation sets the validation function.

func WithWidth
func WithWidth(width int) InputOption

WithWidth sets the input width.

type InputProgram

InputProgram wraps an InputModel in a tea.Program for standalone use.

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

func NewInputProgram
func NewInputProgram(opts ...InputOption) *InputProgram

NewInputProgram creates a new input program for standalone operation.

func (*InputProgram) Run
func (ip *InputProgram) Run() (string, error)

Run runs the input program and returns the entered value.

func (*InputProgram) RunWithCancel
func (ip *InputProgram) RunWithCancel() (value string, cancelled bool, err error)

RunWithCancel runs the input program and returns the entered value and cancellation status.

type InputSubmitMsg

InputSubmitMsg is sent when the input is submitted.

type InputSubmitMsg struct {
    Value string
}

type MultiSelectCancelMsg

MultiSelectCancelMsg is sent when the multi-select is cancelled.

type MultiSelectCancelMsg struct{}

type MultiSelectItem

MultiSelectItem represents a selection candidate used by shared multi-select helpers.

type MultiSelectItem struct {
    ID     string
    Label  string
    Detail string
    Icon   string
}

type MultiSelectModel

MultiSelectModel represents a multi-select picker with fuzzy search filtering.

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

func NewMultiSelect
func NewMultiSelect(opts ...MultiSelectOption) MultiSelectModel

NewMultiSelect creates a new MultiSelectModel.

func (MultiSelectModel) Cancelled
func (m MultiSelectModel) Cancelled() bool

Cancelled returns whether the selection was cancelled.

func (MultiSelectModel) Init
func (m MultiSelectModel) Init() tea.Cmd

Init initializes the multi-select model.

func (MultiSelectModel) Items
func (m MultiSelectModel) Items() []PickerItem

Items returns all items.

func (MultiSelectModel) SelectedItems
func (m MultiSelectModel) SelectedItems() []PickerItem

SelectedItems returns all selected items.

func (*MultiSelectModel) SetItems
func (m *MultiSelectModel) SetItems(items []PickerItem)

SetItems updates the items and resets the filter.

func (MultiSelectModel) Submitted
func (m MultiSelectModel) Submitted() bool

Submitted returns whether the selection was confirmed.

func (MultiSelectModel) Update
func (m MultiSelectModel) Update(msg tea.Msg) (MultiSelectModel, tea.Cmd)

Update handles messages for the multi-select model.

func (MultiSelectModel) View
func (m MultiSelectModel) View() string

View renders the multi-select.

type MultiSelectOption

MultiSelectOption configures a MultiSelectModel.

type MultiSelectOption func(*MultiSelectModel)

func WithMultiSelectHeight
func WithMultiSelectHeight(height int) MultiSelectOption

WithMultiSelectHeight sets the maximum visible items.

func WithMultiSelectItems
func WithMultiSelectItems(items []PickerItem) MultiSelectOption

WithMultiSelectItems sets the initial items.

func WithMultiSelectMaximum
func WithMultiSelectMaximum(max int) MultiSelectOption

WithMultiSelectMaximum sets the maximum allowed selections.

func WithMultiSelectMinimum
func WithMultiSelectMinimum(min int) MultiSelectOption

WithMultiSelectMinimum sets the minimum required selections.

func WithMultiSelectSearch
func WithMultiSelectSearch(enabled bool) MultiSelectOption

WithMultiSelectSearch enables or disables the search input.

func WithMultiSelectStyles
func WithMultiSelectStyles(styles Styles) MultiSelectOption

WithMultiSelectStyles sets custom styles.

func WithMultiSelectTitle
func WithMultiSelectTitle(title string) MultiSelectOption

WithMultiSelectTitle sets the title.

func WithPreselected
func WithPreselected(ids []string) MultiSelectOption

WithPreselected marks specific items as selected by their IDs.

type MultiSelectProgram

MultiSelectProgram wraps a MultiSelectModel in a tea.Program for standalone use.

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

func NewMultiSelectProgram
func NewMultiSelectProgram(opts ...MultiSelectOption) *MultiSelectProgram

NewMultiSelectProgram creates a new multi-select program for standalone operation.

func (*MultiSelectProgram) Run
func (mp *MultiSelectProgram) Run() ([]PickerItem, error)

Run runs the multi-select program and returns the selected items.

type MultiSelectResultMsg

MultiSelectResultMsg is sent when the multi-select is confirmed.

type MultiSelectResultMsg struct {
    Items []PickerItem
}

type PickerCancelMsg

PickerCancelMsg is sent when the picker is cancelled.

type PickerCancelMsg struct{}

type PickerItem

PickerItem represents an item in the picker.

type PickerItem struct {
    ID       string // Unique identifier
    Label    string // Display text
    Detail   string // Additional detail (displayed after label)
    Icon     string // Optional icon prefix
    Selected bool   // For multi-select mode
    Value    any    // Optional associated value
}

func SelectOne
func SelectOne(title string, items []PickerItem) (*PickerItem, error)

SelectOne renders a searchable single-select picker and returns the selected item.

type PickerModel

PickerModel represents a list picker with fuzzy search filtering.

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

func NewPicker
func NewPicker(opts ...PickerOption) PickerModel

NewPicker creates a new PickerModel.

func (PickerModel) Cancelled
func (m PickerModel) Cancelled() bool

Cancelled returns whether the picker was cancelled.

func (PickerModel) Init
func (m PickerModel) Init() tea.Cmd

Init initializes the picker model.

func (PickerModel) Items
func (m PickerModel) Items() []PickerItem

Items returns all items.

func (PickerModel) SelectedItem
func (m PickerModel) SelectedItem() *PickerItem

SelectedItem returns the currently highlighted item, or nil if none.

func (*PickerModel) SetItems
func (m *PickerModel) SetItems(items []PickerItem)

SetItems updates the items and resets the filter.

func (PickerModel) Submitted
func (m PickerModel) Submitted() bool

Submitted returns whether an item was selected.

func (PickerModel) Update
func (m PickerModel) Update(msg tea.Msg) (PickerModel, tea.Cmd)

Update handles messages for the picker model.

func (PickerModel) View
func (m PickerModel) View() string

View renders the picker.

type PickerOption

PickerOption configures a PickerModel.

type PickerOption func(*PickerModel)

func WithPickerHeight
func WithPickerHeight(height int) PickerOption

WithPickerHeight sets the maximum visible items.

func WithPickerItems
func WithPickerItems(items []PickerItem) PickerOption

WithPickerItems sets the initial items.

func WithPickerSearch
func WithPickerSearch(enabled bool) PickerOption

WithPickerSearch enables or disables the search input.

func WithPickerStyles
func WithPickerStyles(styles Styles) PickerOption

WithPickerStyles sets custom styles.

func WithPickerTitle
func WithPickerTitle(title string) PickerOption

WithPickerTitle sets the picker title.

type PickerProgram

PickerProgram wraps a PickerModel in a tea.Program for standalone use.

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

func NewPickerProgram
func NewPickerProgram(opts ...PickerOption) *PickerProgram

NewPickerProgram creates a new picker program for standalone operation.

func (*PickerProgram) Run
func (pp *PickerProgram) Run() (*PickerItem, error)

Run runs the picker program and returns the selected item.

type PickerSelectMsg

PickerSelectMsg is sent when an item is selected.

type PickerSelectMsg struct {
    Item PickerItem
}

type SpinnerCompleteStepMsg

SpinnerCompleteStepMsg marks the current step as completed.

type SpinnerCompleteStepMsg struct {
    Error error
}

type SpinnerDoneMsg

SpinnerDoneMsg signals that the spinner should stop.

type SpinnerDoneMsg struct {
    Error error
}

type SpinnerModel

SpinnerModel represents a progress spinner with optional multi-step display.

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

func NewSpinner
func NewSpinner(opts ...SpinnerOption) SpinnerModel

NewSpinner creates a new SpinnerModel.

func (*SpinnerModel) AddStep
func (m *SpinnerModel) AddStep(msg string)

AddStep adds a new step to the multi-step progress display.

func (*SpinnerModel) CompleteStep
func (m *SpinnerModel) CompleteStep(err error)

CompleteStep marks the current step as completed.

func (SpinnerModel) Done
func (m SpinnerModel) Done() bool

Done returns whether the spinner has completed.

func (SpinnerModel) Error
func (m SpinnerModel) Error() error

Error returns any error that occurred.

func (*SpinnerModel) Finish
func (m *SpinnerModel) Finish(err error)

Finish marks the spinner as done.

func (SpinnerModel) Init
func (m SpinnerModel) Init() tea.Cmd

Init initializes the spinner model.

func (*SpinnerModel) SetMessage
func (m *SpinnerModel) SetMessage(msg string)

SetMessage sets the current message.

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

Update handles messages for the spinner model.

func (SpinnerModel) View
func (m SpinnerModel) View() string

View renders the spinner.

type SpinnerOption

SpinnerOption configures a SpinnerModel.

type SpinnerOption func(*SpinnerModel)

func WithMessage
func WithMessage(msg string) SpinnerOption

WithMessage sets the initial message.

func WithSpinnerStyle
func WithSpinnerStyle(s spinner.Spinner) SpinnerOption

WithSpinnerStyle sets the spinner animation style.

func WithStyles
func WithStyles(styles Styles) SpinnerOption

WithStyles sets custom styles for the spinner.

type SpinnerProgram

SpinnerProgram wraps a SpinnerModel in a tea.Program for standalone use.

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

func NewSpinnerProgram
func NewSpinnerProgram(opts ...SpinnerOption) *SpinnerProgram

NewSpinnerProgram creates a new spinner program for standalone operation.

func (*SpinnerProgram) AddStep
func (sp *SpinnerProgram) AddStep(msg string)

AddStep adds a new step to the spinner.

func (*SpinnerProgram) CompleteStep
func (sp *SpinnerProgram) CompleteStep(err error)

CompleteStep completes the current step.

func (*SpinnerProgram) Done
func (sp *SpinnerProgram) Done(err error)

Done signals completion and stops the spinner.

func (*SpinnerProgram) Start
func (sp *SpinnerProgram) Start() error

Start starts the spinner program in the background.

func (*SpinnerProgram) UpdateMessage
func (sp *SpinnerProgram) UpdateMessage(msg string)

UpdateMessage sends a message update to the spinner.

func (*SpinnerProgram) Wait
func (sp *SpinnerProgram) Wait() error

Wait blocks until the program exits.

type SpinnerStep

SpinnerStep represents a single step in a multi-step progress display.

type SpinnerStep struct {
    Message   string
    Completed bool
    Error     error
}

type SpinnerStepMsg

SpinnerStepMsg adds a new step to the spinner.

type SpinnerStepMsg struct {
    Message string
}

type SpinnerUpdateMsg

SpinnerUpdateMsg updates the spinner message.

type SpinnerUpdateMsg string

type Styles

Styles provides a collection of reusable Lipgloss styles.

type Styles struct {

    // Base styles
    Base lipgloss.Style

    // Title and header styles
    Title    lipgloss.Style
    Subtitle lipgloss.Style
    Header   lipgloss.Style

    // Content styles
    Normal    lipgloss.Style
    Bold      lipgloss.Style
    Muted     lipgloss.Style
    Highlight lipgloss.Style

    // Status styles
    Success lipgloss.Style
    Warning lipgloss.Style
    Error   lipgloss.Style
    Info    lipgloss.Style

    // List/Picker styles
    ListItem         lipgloss.Style
    ListItemSelected lipgloss.Style
    ListCursor       lipgloss.Style

    // Input styles
    InputPrompt      lipgloss.Style
    InputText        lipgloss.Style
    InputPlaceholder lipgloss.Style

    // Border styles
    BorderedBox lipgloss.Style

    // Spinner styles
    Spinner lipgloss.Style

    // Button styles
    ButtonActive   lipgloss.Style
    ButtonInactive lipgloss.Style

    // Checkbox styles
    CheckboxChecked   lipgloss.Style
    CheckboxUnchecked lipgloss.Style

    // Help styles
    HelpKey  lipgloss.Style
    HelpDesc lipgloss.Style
    // contains filtered or unexported fields
}

func DefaultStyles
func DefaultStyles() Styles

DefaultStyles returns a new Styles instance with the default color scheme.

func NewStyles
func NewStyles(scheme ColorScheme) Styles

NewStyles creates a new Styles instance with the given color scheme.

func (Styles) Scheme
func (s Styles) Scheme() ColorScheme

Scheme returns the color scheme used by these styles.

type ValidationFunc

ValidationFunc is a function that validates input and returns an error message if invalid.

type ValidationFunc func(value string) error

Generated by gomarkdoc

`go import "github.com/tagoro9/fotingo/internal/ui"


Package ui provides reusable Bubble Tea UI components for the fotingo CLI.

## Index

- [Variables](<#variables>)
- [func Confirm\(prompt string, defaultYes bool\) \(bool, error\)](<#Confirm>)
- [func GetEditor\(\) string](<#GetEditor>)
- [func HasEditor\(\) bool](<#HasEditor>)
- [func IssueTypeIcon\(issueType string\) string](<#IssueTypeIcon>)
- [func OpenEditor\(initialContent string\) \(string, error\)](<#OpenEditor>)
- [func OpenEditorOrFallback\(initialContent string, fallback string\) string](<#OpenEditorOrFallback>)
- [func OpenEditorWithConfig\(config EditorConfig\) \(string, error\)](<#OpenEditorWithConfig>)
- [func RenderStaticSpinner\(message string, completed bool, err error\) string](<#RenderStaticSpinner>)
- [type ColorScheme](<#ColorScheme>)
  - [func DarkScheme\(\) ColorScheme](<#DarkScheme>)
  - [func DefaultScheme\(\) ColorScheme](<#DefaultScheme>)
  - [func LightScheme\(\) ColorScheme](<#LightScheme>)
- [type ConfirmModel](<#ConfirmModel>)
  - [func NewConfirm\(opts ...ConfirmOption\) ConfirmModel](<#NewConfirm>)
  - [func \(m ConfirmModel\) Cancelled\(\) bool](<#ConfirmModel.Cancelled>)
  - [func \(m ConfirmModel\) Confirmed\(\) bool](<#ConfirmModel.Confirmed>)
  - [func \(m ConfirmModel\) Init\(\) tea.Cmd](<#ConfirmModel.Init>)
  - [func \(m ConfirmModel\) Selected\(\) bool](<#ConfirmModel.Selected>)
  - [func \(m ConfirmModel\) Update\(msg tea.Msg\) \(ConfirmModel, tea.Cmd\)](<#ConfirmModel.Update>)
  - [func \(m ConfirmModel\) View\(\) string](<#ConfirmModel.View>)
- [type ConfirmOption](<#ConfirmOption>)
  - [func WithConfirmPrompt\(prompt string\) ConfirmOption](<#WithConfirmPrompt>)
  - [func WithConfirmStyles\(styles Styles\) ConfirmOption](<#WithConfirmStyles>)
  - [func WithDefaultNo\(\) ConfirmOption](<#WithDefaultNo>)
  - [func WithDefaultYes\(\) ConfirmOption](<#WithDefaultYes>)
  - [func WithShowButtons\(\) ConfirmOption](<#WithShowButtons>)
- [type ConfirmProgram](<#ConfirmProgram>)
  - [func NewConfirmProgram\(opts ...ConfirmOption\) \*ConfirmProgram](<#NewConfirmProgram>)
  - [func \(cp \*ConfirmProgram\) Run\(\) \(confirmed bool, cancelled bool, err error\)](<#ConfirmProgram.Run>)
- [type ConfirmResultMsg](<#ConfirmResultMsg>)
- [type Editor](<#Editor>)
  - [func NewEditor\(config EditorConfig\) \(\*Editor, error\)](<#NewEditor>)
  - [func \(e \*Editor\) Edit\(\) \(string, error\)](<#Editor.Edit>)
  - [func \(e \*Editor\) FilePath\(\) string](<#Editor.FilePath>)
- [type EditorConfig](<#EditorConfig>)
  - [func DefaultEditorConfig\(\) EditorConfig](<#DefaultEditorConfig>)
- [type InputCancelMsg](<#InputCancelMsg>)
- [type InputModel](<#InputModel>)
  - [func NewInput\(opts ...InputOption\) InputModel](<#NewInput>)
  - [func \(m \*InputModel\) Blur\(\)](<#InputModel.Blur>)
  - [func \(m InputModel\) Cancelled\(\) bool](<#InputModel.Cancelled>)
  - [func \(m InputModel\) Error\(\) error](<#InputModel.Error>)
  - [func \(m \*InputModel\) Focus\(\) tea.Cmd](<#InputModel.Focus>)
  - [func \(m InputModel\) Init\(\) tea.Cmd](<#InputModel.Init>)
  - [func \(m \*InputModel\) Reset\(\)](<#InputModel.Reset>)
  - [func \(m \*InputModel\) SetValue\(value string\)](<#InputModel.SetValue>)
  - [func \(m InputModel\) Submitted\(\) bool](<#InputModel.Submitted>)
  - [func \(m InputModel\) Update\(msg tea.Msg\) \(InputModel, tea.Cmd\)](<#InputModel.Update>)
  - [func \(m InputModel\) Value\(\) string](<#InputModel.Value>)
  - [func \(m InputModel\) View\(\) string](<#InputModel.View>)
- [type InputOption](<#InputOption>)
  - [func WithCharLimit\(limit int\) InputOption](<#WithCharLimit>)
  - [func WithInitialValue\(value string\) InputOption](<#WithInitialValue>)
  - [func WithInputStyles\(styles Styles\) InputOption](<#WithInputStyles>)
  - [func WithMasked\(\) InputOption](<#WithMasked>)
  - [func WithPlaceholder\(placeholder string\) InputOption](<#WithPlaceholder>)
  - [func WithPrompt\(prompt string\) InputOption](<#WithPrompt>)
  - [func WithValidation\(fn ValidationFunc\) InputOption](<#WithValidation>)
  - [func WithWidth\(width int\) InputOption](<#WithWidth>)
- [type InputProgram](<#InputProgram>)
  - [func NewInputProgram\(opts ...InputOption\) \*InputProgram](<#NewInputProgram>)
  - [func \(ip \*InputProgram\) Run\(\) \(string, error\)](<#InputProgram.Run>)
  - [func \(ip \*InputProgram\) RunWithCancel\(\) \(value string, cancelled bool, err error\)](<#InputProgram.RunWithCancel>)
- [type InputSubmitMsg](<#InputSubmitMsg>)
- [type MultiSelectCancelMsg](<#MultiSelectCancelMsg>)
- [type MultiSelectModel](<#MultiSelectModel>)
  - [func NewMultiSelect\(opts ...MultiSelectOption\) MultiSelectModel](<#NewMultiSelect>)
  - [func \(m MultiSelectModel\) Cancelled\(\) bool](<#MultiSelectModel.Cancelled>)
  - [func \(m MultiSelectModel\) Init\(\) tea.Cmd](<#MultiSelectModel.Init>)
  - [func \(m MultiSelectModel\) Items\(\) \[\]PickerItem](<#MultiSelectModel.Items>)
  - [func \(m MultiSelectModel\) SelectedItems\(\) \[\]PickerItem](<#MultiSelectModel.SelectedItems>)
  - [func \(m \*MultiSelectModel\) SetItems\(items \[\]PickerItem\)](<#MultiSelectModel.SetItems>)
  - [func \(m MultiSelectModel\) Submitted\(\) bool](<#MultiSelectModel.Submitted>)
  - [func \(m MultiSelectModel\) Update\(msg tea.Msg\) \(MultiSelectModel, tea.Cmd\)](<#MultiSelectModel.Update>)
  - [func \(m MultiSelectModel\) View\(\) string](<#MultiSelectModel.View>)
- [type MultiSelectOption](<#MultiSelectOption>)
  - [func WithMultiSelectHeight\(height int\) MultiSelectOption](<#WithMultiSelectHeight>)
  - [func WithMultiSelectItems\(items \[\]PickerItem\) MultiSelectOption](<#WithMultiSelectItems>)
  - [func WithMultiSelectMaximum\(max int\) MultiSelectOption](<#WithMultiSelectMaximum>)
  - [func WithMultiSelectMinimum\(min int\) MultiSelectOption](<#WithMultiSelectMinimum>)
  - [func WithMultiSelectSearch\(enabled bool\) MultiSelectOption](<#WithMultiSelectSearch>)
  - [func WithMultiSelectStyles\(styles Styles\) MultiSelectOption](<#WithMultiSelectStyles>)
  - [func WithMultiSelectTitle\(title string\) MultiSelectOption](<#WithMultiSelectTitle>)
  - [func WithPreselected\(ids \[\]string\) MultiSelectOption](<#WithPreselected>)
- [type MultiSelectProgram](<#MultiSelectProgram>)
  - [func NewMultiSelectProgram\(opts ...MultiSelectOption\) \*MultiSelectProgram](<#NewMultiSelectProgram>)
  - [func \(mp \*MultiSelectProgram\) Run\(\) \(\[\]PickerItem, error\)](<#MultiSelectProgram.Run>)
- [type MultiSelectResultMsg](<#MultiSelectResultMsg>)
- [type PickerCancelMsg](<#PickerCancelMsg>)
- [type PickerItem](<#PickerItem>)
- [type PickerModel](<#PickerModel>)
  - [func NewPicker\(opts ...PickerOption\) PickerModel](<#NewPicker>)
  - [func \(m PickerModel\) Cancelled\(\) bool](<#PickerModel.Cancelled>)
  - [func \(m PickerModel\) Init\(\) tea.Cmd](<#PickerModel.Init>)
  - [func \(m PickerModel\) Items\(\) \[\]PickerItem](<#PickerModel.Items>)
  - [func \(m PickerModel\) SelectedItem\(\) \*PickerItem](<#PickerModel.SelectedItem>)
  - [func \(m \*PickerModel\) SetItems\(items \[\]PickerItem\)](<#PickerModel.SetItems>)
  - [func \(m PickerModel\) Submitted\(\) bool](<#PickerModel.Submitted>)
  - [func \(m PickerModel\) Update\(msg tea.Msg\) \(PickerModel, tea.Cmd\)](<#PickerModel.Update>)
  - [func \(m PickerModel\) View\(\) string](<#PickerModel.View>)
- [type PickerOption](<#PickerOption>)
  - [func WithPickerHeight\(height int\) PickerOption](<#WithPickerHeight>)
  - [func WithPickerItems\(items \[\]PickerItem\) PickerOption](<#WithPickerItems>)
  - [func WithPickerSearch\(enabled bool\) PickerOption](<#WithPickerSearch>)
  - [func WithPickerStyles\(styles Styles\) PickerOption](<#WithPickerStyles>)
  - [func WithPickerTitle\(title string\) PickerOption](<#WithPickerTitle>)
- [type PickerProgram](<#PickerProgram>)
  - [func NewPickerProgram\(opts ...PickerOption\) \*PickerProgram](<#NewPickerProgram>)
  - [func \(pp \*PickerProgram\) Run\(\) \(\*PickerItem, error\)](<#PickerProgram.Run>)
- [type PickerSelectMsg](<#PickerSelectMsg>)
- [type SpinnerCompleteStepMsg](<#SpinnerCompleteStepMsg>)
- [type SpinnerDoneMsg](<#SpinnerDoneMsg>)
- [type SpinnerModel](<#SpinnerModel>)
  - [func NewSpinner\(opts ...SpinnerOption\) SpinnerModel](<#NewSpinner>)
  - [func \(m \*SpinnerModel\) AddStep\(msg string\)](<#SpinnerModel.AddStep>)
  - [func \(m \*SpinnerModel\) CompleteStep\(err error\)](<#SpinnerModel.CompleteStep>)
  - [func \(m SpinnerModel\) Done\(\) bool](<#SpinnerModel.Done>)
  - [func \(m SpinnerModel\) Error\(\) error](<#SpinnerModel.Error>)
  - [func \(m \*SpinnerModel\) Finish\(err error\)](<#SpinnerModel.Finish>)
  - [func \(m SpinnerModel\) Init\(\) tea.Cmd](<#SpinnerModel.Init>)
  - [func \(m \*SpinnerModel\) SetMessage\(msg string\)](<#SpinnerModel.SetMessage>)
  - [func \(m SpinnerModel\) Update\(msg tea.Msg\) \(SpinnerModel, tea.Cmd\)](<#SpinnerModel.Update>)
  - [func \(m SpinnerModel\) View\(\) string](<#SpinnerModel.View>)
- [type SpinnerOption](<#SpinnerOption>)
  - [func WithMessage\(msg string\) SpinnerOption](<#WithMessage>)
  - [func WithSpinnerStyle\(s spinner.Spinner\) SpinnerOption](<#WithSpinnerStyle>)
  - [func WithStyles\(styles Styles\) SpinnerOption](<#WithStyles>)
- [type SpinnerProgram](<#SpinnerProgram>)
  - [func NewSpinnerProgram\(opts ...SpinnerOption\) \*SpinnerProgram](<#NewSpinnerProgram>)
  - [func \(sp \*SpinnerProgram\) AddStep\(msg string\)](<#SpinnerProgram.AddStep>)
  - [func \(sp \*SpinnerProgram\) CompleteStep\(err error\)](<#SpinnerProgram.CompleteStep>)
  - [func \(sp \*SpinnerProgram\) Done\(err error\)](<#SpinnerProgram.Done>)
  - [func \(sp \*SpinnerProgram\) Start\(\) error](<#SpinnerProgram.Start>)
  - [func \(sp \*SpinnerProgram\) UpdateMessage\(msg string\)](<#SpinnerProgram.UpdateMessage>)
  - [func \(sp \*SpinnerProgram\) Wait\(\) error](<#SpinnerProgram.Wait>)
- [type SpinnerStep](<#SpinnerStep>)
- [type SpinnerStepMsg](<#SpinnerStepMsg>)
- [type SpinnerUpdateMsg](<#SpinnerUpdateMsg>)
- [type Styles](<#Styles>)
  - [func DefaultStyles\(\) Styles](<#DefaultStyles>)
  - [func NewStyles\(scheme ColorScheme\) Styles](<#NewStyles>)
  - [func \(s Styles\) Scheme\(\) ColorScheme](<#Styles.Scheme>)
- [type ValidationFunc](<#ValidationFunc>)


## Variables

<a name="ErrEditorEmpty"></a>ErrEditorEmpty is returned when the editor content is empty.

```go
var ErrEditorEmpty = errors.New(i18n.T(i18n.UIErrEditorEmpty))

ErrEditorFailed is returned when the editor exits with an error.

var ErrEditorFailed = errors.New(i18n.T(i18n.UIErrEditorFailed))

ErrNoEditor is returned when no editor is available.

var ErrNoEditor = errors.New(i18n.T(i18n.UIErrNoEditor))

Icons provides consistent unicode icons for UI elements.

var Icons = struct {
    // Issue type icons
    Bug         string
    Story       string
    Task        string
    Epic        string
    Subtask     string
    Improvement string
    NewFeature  string
    Unknown     string

    // Status icons
    Check    string
    Cross    string
    Warning  string
    Info     string
    Question string

    // UI icons
    Cursor    string
    Checkbox  string
    Selected  string
    Arrow     string
    Spinner   string
    Ellipsis  string
    Separator string
}{

    Bug:         "[B]",
    Story:       "[S]",
    Task:        "[T]",
    Epic:        "[E]",
    Subtask:     "[s]",
    Improvement: "[I]",
    NewFeature:  "[N]",
    Unknown:     "[?]",

    Check:    "[v]",
    Cross:    "[x]",
    Warning:  "[!]",
    Info:     "[i]",
    Question: "[?]",

    Cursor:    ">",
    Checkbox:  "[ ]",
    Selected:  "[x]",
    Arrow:     "->",
    Spinner:   "*",
    Ellipsis:  "...",
    Separator: "|",
}

Spacing provides consistent spacing values.

var Spacing = struct {
    None   int
    Small  int
    Medium int
    Large  int
}{
    None:   0,
    Small:  1,
    Medium: 2,
    Large:  4,
}

func Confirm

func Confirm(prompt string, defaultYes bool) (bool, error)

Confirm is a helper function to show a confirmation prompt and return the result.

func GetEditor

func GetEditor() string

GetEditor returns the path to the editor command.

func HasEditor

func HasEditor() bool

HasEditor returns true if an editor is available.

func IssueTypeIcon

func IssueTypeIcon(issueType string) string

IssueTypeIcon returns the appropriate icon for a Jira issue type.

func OpenEditor

func OpenEditor(initialContent string) (string, error)

OpenEditor is a convenience function to open an editor with content and return the result.

func OpenEditorOrFallback

func OpenEditorOrFallback(initialContent string, fallback string) string

OpenEditorOrFallback opens an editor if available, otherwise returns the fallback content.

func OpenEditorWithConfig

func OpenEditorWithConfig(config EditorConfig) (string, error)

OpenEditorWithConfig is a convenience function to open an editor with custom config.

func RenderStaticSpinner

func RenderStaticSpinner(message string, completed bool, err error) string

RenderStaticSpinner renders a non-animated spinner view for non-TTY output.

type ColorScheme

ColorScheme defines the color palette for UI components.

type ColorScheme struct {
    // Primary colors
    Primary   lipgloss.TerminalColor
    Secondary lipgloss.TerminalColor
    Accent    lipgloss.TerminalColor

    // Status colors
    Success lipgloss.TerminalColor
    Warning lipgloss.TerminalColor
    Error   lipgloss.TerminalColor
    Info    lipgloss.TerminalColor

    // UI colors
    Border     lipgloss.TerminalColor
    Muted      lipgloss.TerminalColor
    Background lipgloss.TerminalColor
    Foreground lipgloss.TerminalColor

    // Selection colors
    Selected   lipgloss.TerminalColor
    Unselected lipgloss.TerminalColor
    Cursor     lipgloss.TerminalColor
}

func DarkScheme
func DarkScheme() ColorScheme

DarkScheme returns the color scheme for dark terminals.

func DefaultScheme
func DefaultScheme() ColorScheme

DefaultScheme returns the appropriate color scheme based on terminal settings. It respects NO_COLOR environment variable.

func LightScheme
func LightScheme() ColorScheme

LightScheme returns the color scheme for light terminals.

type ConfirmModel

ConfirmModel represents a y/n confirmation prompt.

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

func NewConfirm
func NewConfirm(opts ...ConfirmOption) ConfirmModel

NewConfirm creates a new ConfirmModel.

func (ConfirmModel) Cancelled
func (m ConfirmModel) Cancelled() bool

Cancelled returns whether the prompt was cancelled.

func (ConfirmModel) Confirmed
func (m ConfirmModel) Confirmed() bool

Confirmed returns whether Yes was selected.

func (ConfirmModel) Init
func (m ConfirmModel) Init() tea.Cmd

Init initializes the confirmation model.

func (ConfirmModel) Selected
func (m ConfirmModel) Selected() bool

Selected returns the current selection (true = Yes, false = No).

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

Update handles messages for the confirmation model.

func (ConfirmModel) View
func (m ConfirmModel) View() string

View renders the confirmation prompt.

type ConfirmOption

ConfirmOption configures a ConfirmModel.

type ConfirmOption func(*ConfirmModel)

func WithConfirmPrompt
func WithConfirmPrompt(prompt string) ConfirmOption

WithConfirmPrompt sets the confirmation prompt text.

func WithConfirmStyles
func WithConfirmStyles(styles Styles) ConfirmOption

WithConfirmStyles sets custom styles for the confirmation.

func WithDefaultNo
func WithDefaultNo() ConfirmOption

WithDefaultNo sets the default selection to No.

func WithDefaultYes
func WithDefaultYes() ConfirmOption

WithDefaultYes sets the default selection to Yes.

func WithShowButtons
func WithShowButtons() ConfirmOption

WithShowButtons enables button-style display.

type ConfirmProgram

ConfirmProgram wraps a ConfirmModel in a tea.Program for standalone use.

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

func NewConfirmProgram
func NewConfirmProgram(opts ...ConfirmOption) *ConfirmProgram

NewConfirmProgram creates a new confirmation program for standalone operation.

func (*ConfirmProgram) Run
func (cp *ConfirmProgram) Run() (confirmed bool, cancelled bool, err error)

Run runs the confirmation program and returns the result.

type ConfirmResultMsg

ConfirmResultMsg is sent when the confirmation is resolved.

type ConfirmResultMsg struct {
    Confirmed bool
    Cancelled bool
}

type Editor

Editor provides functionality to open an external editor.

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

func NewEditor
func NewEditor(config EditorConfig) (*Editor, error)

NewEditor creates a new Editor instance.

func (*Editor) Edit
func (e *Editor) Edit() (string, error)

Edit opens the editor with the initial content and returns the edited content.

func (*Editor) FilePath
func (e *Editor) FilePath() string

FilePath returns the path of the temp file (useful if DeleteOnClose is false).

type EditorConfig

EditorConfig configures the editor behavior.

type EditorConfig struct {
    // Extension is the file extension for the temp file (default: ".md")
    Extension string

    // InitialContent is the initial content to show in the editor
    InitialContent string

    // Prefix is a prefix for the temp file name
    Prefix string

    // AllowEmpty if true, allows empty content to be returned
    AllowEmpty bool

    // DeleteOnClose if true, deletes the temp file after editing
    DeleteOnClose bool
}

func DefaultEditorConfig
func DefaultEditorConfig() EditorConfig

DefaultEditorConfig returns the default editor configuration.

type InputCancelMsg

InputCancelMsg is sent when the input is cancelled.

type InputCancelMsg struct{}

type InputModel

InputModel represents a styled text input with validation support.

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

func NewInput
func NewInput(opts ...InputOption) InputModel

NewInput creates a new InputModel.

func (*InputModel) Blur
func (m *InputModel) Blur()

Blur removes focus from the input.

func (InputModel) Cancelled
func (m InputModel) Cancelled() bool

Cancelled returns whether the input was cancelled.

func (InputModel) Error
func (m InputModel) Error() error

Error returns any validation error.

func (*InputModel) Focus
func (m *InputModel) Focus() tea.Cmd

Focus focuses the input.

func (InputModel) Init
func (m InputModel) Init() tea.Cmd

Init initializes the input model.

func (*InputModel) Reset
func (m *InputModel) Reset()

Reset resets the input state.

func (*InputModel) SetValue
func (m *InputModel) SetValue(value string)

SetValue sets the input value.

func (InputModel) Submitted
func (m InputModel) Submitted() bool

Submitted returns whether the input was submitted.

func (InputModel) Update
func (m InputModel) Update(msg tea.Msg) (InputModel, tea.Cmd)

Update handles messages for the input model.

func (InputModel) Value
func (m InputModel) Value() string

Value returns the current input value.

func (InputModel) View
func (m InputModel) View() string

View renders the input.

type InputOption

InputOption configures an InputModel.

type InputOption func(*InputModel)

func WithCharLimit
func WithCharLimit(limit int) InputOption

WithCharLimit sets the character limit.

func WithInitialValue
func WithInitialValue(value string) InputOption

WithInitialValue sets the initial input value.

func WithInputStyles
func WithInputStyles(styles Styles) InputOption

WithInputStyles sets custom styles for the input.

func WithMasked
func WithMasked() InputOption

WithMasked enables password masking mode.

func WithPlaceholder
func WithPlaceholder(placeholder string) InputOption

WithPlaceholder sets the placeholder text.

func WithPrompt
func WithPrompt(prompt string) InputOption

WithPrompt sets the input prompt text.

func WithValidation
func WithValidation(fn ValidationFunc) InputOption

WithValidation sets the validation function.

func WithWidth
func WithWidth(width int) InputOption

WithWidth sets the input width.

type InputProgram

InputProgram wraps an InputModel in a tea.Program for standalone use.

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

func NewInputProgram
func NewInputProgram(opts ...InputOption) *InputProgram

NewInputProgram creates a new input program for standalone operation.

func (*InputProgram) Run
func (ip *InputProgram) Run() (string, error)

Run runs the input program and returns the entered value.

func (*InputProgram) RunWithCancel
func (ip *InputProgram) RunWithCancel() (value string, cancelled bool, err error)

RunWithCancel runs the input program and returns the entered value and cancellation status.

type InputSubmitMsg

InputSubmitMsg is sent when the input is submitted.

type InputSubmitMsg struct {
    Value string
}

type MultiSelectCancelMsg

MultiSelectCancelMsg is sent when the multi-select is cancelled.

type MultiSelectCancelMsg struct{}

type MultiSelectModel

MultiSelectModel represents a multi-select picker with fuzzy search filtering.

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

func NewMultiSelect
func NewMultiSelect(opts ...MultiSelectOption) MultiSelectModel

NewMultiSelect creates a new MultiSelectModel.

func (MultiSelectModel) Cancelled
func (m MultiSelectModel) Cancelled() bool

Cancelled returns whether the selection was cancelled.

func (MultiSelectModel) Init
func (m MultiSelectModel) Init() tea.Cmd

Init initializes the multi-select model.

func (MultiSelectModel) Items
func (m MultiSelectModel) Items() []PickerItem

Items returns all items.

func (MultiSelectModel) SelectedItems
func (m MultiSelectModel) SelectedItems() []PickerItem

SelectedItems returns all selected items.

func (*MultiSelectModel) SetItems
func (m *MultiSelectModel) SetItems(items []PickerItem)

SetItems updates the items and resets the filter.

func (MultiSelectModel) Submitted
func (m MultiSelectModel) Submitted() bool

Submitted returns whether the selection was confirmed.

func (MultiSelectModel) Update
func (m MultiSelectModel) Update(msg tea.Msg) (MultiSelectModel, tea.Cmd)

Update handles messages for the multi-select model.

func (MultiSelectModel) View
func (m MultiSelectModel) View() string

View renders the multi-select.

type MultiSelectOption

MultiSelectOption configures a MultiSelectModel.

type MultiSelectOption func(*MultiSelectModel)

func WithMultiSelectHeight
func WithMultiSelectHeight(height int) MultiSelectOption

WithMultiSelectHeight sets the maximum visible items.

func WithMultiSelectItems
func WithMultiSelectItems(items []PickerItem) MultiSelectOption

WithMultiSelectItems sets the initial items.

func WithMultiSelectMaximum
func WithMultiSelectMaximum(max int) MultiSelectOption

WithMultiSelectMaximum sets the maximum allowed selections.

func WithMultiSelectMinimum
func WithMultiSelectMinimum(min int) MultiSelectOption

WithMultiSelectMinimum sets the minimum required selections.

func WithMultiSelectSearch
func WithMultiSelectSearch(enabled bool) MultiSelectOption

WithMultiSelectSearch enables or disables the search input.

func WithMultiSelectStyles
func WithMultiSelectStyles(styles Styles) MultiSelectOption

WithMultiSelectStyles sets custom styles.

func WithMultiSelectTitle
func WithMultiSelectTitle(title string) MultiSelectOption

WithMultiSelectTitle sets the title.

func WithPreselected
func WithPreselected(ids []string) MultiSelectOption

WithPreselected marks specific items as selected by their IDs.

type MultiSelectProgram

MultiSelectProgram wraps a MultiSelectModel in a tea.Program for standalone use.

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

func NewMultiSelectProgram
func NewMultiSelectProgram(opts ...MultiSelectOption) *MultiSelectProgram

NewMultiSelectProgram creates a new multi-select program for standalone operation.

func (*MultiSelectProgram) Run
func (mp *MultiSelectProgram) Run() ([]PickerItem, error)

Run runs the multi-select program and returns the selected items.

type MultiSelectResultMsg

MultiSelectResultMsg is sent when the multi-select is confirmed.

type MultiSelectResultMsg struct {
    Items []PickerItem
}

type PickerCancelMsg

PickerCancelMsg is sent when the picker is cancelled.

type PickerCancelMsg struct{}

type PickerItem

PickerItem represents an item in the picker.

type PickerItem struct {
    ID       string // Unique identifier
    Label    string // Display text
    Detail   string // Additional detail (displayed after label)
    Icon     string // Optional icon prefix
    Selected bool   // For multi-select mode
    Value    any    // Optional associated value
}

type PickerModel

PickerModel represents a list picker with fuzzy search filtering.

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

func NewPicker
func NewPicker(opts ...PickerOption) PickerModel

NewPicker creates a new PickerModel.

func (PickerModel) Cancelled
func (m PickerModel) Cancelled() bool

Cancelled returns whether the picker was cancelled.

func (PickerModel) Init
func (m PickerModel) Init() tea.Cmd

Init initializes the picker model.

func (PickerModel) Items
func (m PickerModel) Items() []PickerItem

Items returns all items.

func (PickerModel) SelectedItem
func (m PickerModel) SelectedItem() *PickerItem

SelectedItem returns the currently highlighted item, or nil if none.

func (*PickerModel) SetItems
func (m *PickerModel) SetItems(items []PickerItem)

SetItems updates the items and resets the filter.

func (PickerModel) Submitted
func (m PickerModel) Submitted() bool

Submitted returns whether an item was selected.

func (PickerModel) Update
func (m PickerModel) Update(msg tea.Msg) (PickerModel, tea.Cmd)

Update handles messages for the picker model.

func (PickerModel) View
func (m PickerModel) View() string

View renders the picker.

type PickerOption

PickerOption configures a PickerModel.

type PickerOption func(*PickerModel)

func WithPickerHeight
func WithPickerHeight(height int) PickerOption

WithPickerHeight sets the maximum visible items.

func WithPickerItems
func WithPickerItems(items []PickerItem) PickerOption

WithPickerItems sets the initial items.

func WithPickerSearch
func WithPickerSearch(enabled bool) PickerOption

WithPickerSearch enables or disables the search input.

func WithPickerStyles
func WithPickerStyles(styles Styles) PickerOption

WithPickerStyles sets custom styles.

func WithPickerTitle
func WithPickerTitle(title string) PickerOption

WithPickerTitle sets the picker title.

type PickerProgram

PickerProgram wraps a PickerModel in a tea.Program for standalone use.

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

func NewPickerProgram
func NewPickerProgram(opts ...PickerOption) *PickerProgram

NewPickerProgram creates a new picker program for standalone operation.

func (*PickerProgram) Run
func (pp *PickerProgram) Run() (*PickerItem, error)

Run runs the picker program and returns the selected item.

type PickerSelectMsg

PickerSelectMsg is sent when an item is selected.

type PickerSelectMsg struct {
    Item PickerItem
}

type SpinnerCompleteStepMsg

SpinnerCompleteStepMsg marks the current step as completed.

type SpinnerCompleteStepMsg struct {
    Error error
}

type SpinnerDoneMsg

SpinnerDoneMsg signals that the spinner should stop.

type SpinnerDoneMsg struct {
    Error error
}

type SpinnerModel

SpinnerModel represents a progress spinner with optional multi-step display.

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

func NewSpinner
func NewSpinner(opts ...SpinnerOption) SpinnerModel

NewSpinner creates a new SpinnerModel.

func (*SpinnerModel) AddStep
func (m *SpinnerModel) AddStep(msg string)

AddStep adds a new step to the multi-step progress display.

func (*SpinnerModel) CompleteStep
func (m *SpinnerModel) CompleteStep(err error)

CompleteStep marks the current step as completed.

func (SpinnerModel) Done
func (m SpinnerModel) Done() bool

Done returns whether the spinner has completed.

func (SpinnerModel) Error
func (m SpinnerModel) Error() error

Error returns any error that occurred.

func (*SpinnerModel) Finish
func (m *SpinnerModel) Finish(err error)

Finish marks the spinner as done.

func (SpinnerModel) Init
func (m SpinnerModel) Init() tea.Cmd

Init initializes the spinner model.

func (*SpinnerModel) SetMessage
func (m *SpinnerModel) SetMessage(msg string)

SetMessage sets the current message.

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

Update handles messages for the spinner model.

func (SpinnerModel) View
func (m SpinnerModel) View() string

View renders the spinner.

type SpinnerOption

SpinnerOption configures a SpinnerModel.

type SpinnerOption func(*SpinnerModel)

func WithMessage
func WithMessage(msg string) SpinnerOption

WithMessage sets the initial message.

func WithSpinnerStyle
func WithSpinnerStyle(s spinner.Spinner) SpinnerOption

WithSpinnerStyle sets the spinner animation style.

func WithStyles
func WithStyles(styles Styles) SpinnerOption

WithStyles sets custom styles for the spinner.

type SpinnerProgram

SpinnerProgram wraps a SpinnerModel in a tea.Program for standalone use.

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

func NewSpinnerProgram
func NewSpinnerProgram(opts ...SpinnerOption) *SpinnerProgram

NewSpinnerProgram creates a new spinner program for standalone operation.

func (*SpinnerProgram) AddStep
func (sp *SpinnerProgram) AddStep(msg string)

AddStep adds a new step to the spinner.

func (*SpinnerProgram) CompleteStep
func (sp *SpinnerProgram) CompleteStep(err error)

CompleteStep completes the current step.

func (*SpinnerProgram) Done
func (sp *SpinnerProgram) Done(err error)

Done signals completion and stops the spinner.

func (*SpinnerProgram) Start
func (sp *SpinnerProgram) Start() error

Start starts the spinner program in the background.

func (*SpinnerProgram) UpdateMessage
func (sp *SpinnerProgram) UpdateMessage(msg string)

UpdateMessage sends a message update to the spinner.

func (*SpinnerProgram) Wait
func (sp *SpinnerProgram) Wait() error

Wait blocks until the program exits.

type SpinnerStep

SpinnerStep represents a single step in a multi-step progress display.

type SpinnerStep struct {
    Message   string
    Completed bool
    Error     error
}

type SpinnerStepMsg

SpinnerStepMsg adds a new step to the spinner.

type SpinnerStepMsg struct {
    Message string
}

type SpinnerUpdateMsg

SpinnerUpdateMsg updates the spinner message.

type SpinnerUpdateMsg string

type Styles

Styles provides a collection of reusable Lipgloss styles.

type Styles struct {

    // Base styles
    Base lipgloss.Style

    // Title and header styles
    Title    lipgloss.Style
    Subtitle lipgloss.Style
    Header   lipgloss.Style

    // Content styles
    Normal    lipgloss.Style
    Bold      lipgloss.Style
    Muted     lipgloss.Style
    Highlight lipgloss.Style

    // Status styles
    Success lipgloss.Style
    Warning lipgloss.Style
    Error   lipgloss.Style
    Info    lipgloss.Style

    // List/Picker styles
    ListItem         lipgloss.Style
    ListItemSelected lipgloss.Style
    ListCursor       lipgloss.Style

    // Input styles
    InputPrompt      lipgloss.Style
    InputText        lipgloss.Style
    InputPlaceholder lipgloss.Style

    // Border styles
    BorderedBox lipgloss.Style

    // Spinner styles
    Spinner lipgloss.Style

    // Button styles
    ButtonActive   lipgloss.Style
    ButtonInactive lipgloss.Style

    // Checkbox styles
    CheckboxChecked   lipgloss.Style
    CheckboxUnchecked lipgloss.Style

    // Help styles
    HelpKey  lipgloss.Style
    HelpDesc lipgloss.Style
    // contains filtered or unexported fields
}

func DefaultStyles
func DefaultStyles() Styles

DefaultStyles returns a new Styles instance with the default color scheme.

func NewStyles
func NewStyles(scheme ColorScheme) Styles

NewStyles creates a new Styles instance with the given color scheme.

func (Styles) Scheme
func (s Styles) Scheme() ColorScheme

Scheme returns the color scheme used by these styles.

type ValidationFunc

ValidationFunc is a function that validates input and returns an error message if invalid.

type ValidationFunc func(value string) error

Generated by gomarkdoc

Documentation

Overview

Package ui provides reusable Bubble Tea primitives shared across interactive commands.

Package ui provides reusable Bubble Tea UI components for the fotingo CLI.

Index

Constants

This section is empty.

Variables

View Source
var ErrEditorEmpty = errors.New(i18n.T(i18n.UIErrEditorEmpty))

ErrEditorEmpty is returned when the editor content is empty.

View Source
var ErrEditorFailed = errors.New(i18n.T(i18n.UIErrEditorFailed))

ErrEditorFailed is returned when the editor exits with an error.

View Source
var ErrNoEditor = errors.New(i18n.T(i18n.UIErrNoEditor))

ErrNoEditor is returned when no editor is available.

View Source
var Icons = struct {
	// Issue type icons
	Bug         string
	Story       string
	Task        string
	Epic        string
	Subtask     string
	Improvement string
	NewFeature  string
	Unknown     string

	// Status icons
	Check    string
	Cross    string
	Warning  string
	Info     string
	Question string

	// UI icons
	Cursor    string
	Checkbox  string
	Selected  string
	Arrow     string
	Spinner   string
	Ellipsis  string
	Separator string
}{

	Bug:         "[B]",
	Story:       "[S]",
	Task:        "[T]",
	Epic:        "[E]",
	Subtask:     "[s]",
	Improvement: "[I]",
	NewFeature:  "[N]",
	Unknown:     "[?]",

	Check:    "[v]",
	Cross:    "[x]",
	Warning:  "[!]",
	Info:     "[i]",
	Question: "[?]",

	Cursor:    ">",
	Checkbox:  "[ ]",
	Selected:  "[x]",
	Arrow:     "->",
	Spinner:   "*",
	Ellipsis:  "...",
	Separator: "|",
}

Icons provides consistent unicode icons for UI elements.

View Source
var Spacing = struct {
	None   int
	Small  int
	Medium int
	Large  int
}{
	None:   0,
	Small:  1,
	Medium: 2,
	Large:  4,
}

Spacing provides consistent spacing values.

Functions

func Confirm

func Confirm(prompt string, defaultYes bool) (bool, error)

Confirm is a helper function to show a confirmation prompt and return the result.

func GetEditor

func GetEditor() string

GetEditor returns the path to the editor command.

func HasEditor

func HasEditor() bool

HasEditor returns true if an editor is available.

func IssueTypeIcon

func IssueTypeIcon(issueType string) string

IssueTypeIcon returns the appropriate icon for a Jira issue type.

func OpenEditor

func OpenEditor(initialContent string) (string, error)

OpenEditor is a convenience function to open an editor with content and return the result.

func OpenEditorOrFallback

func OpenEditorOrFallback(initialContent string, fallback string) string

OpenEditorOrFallback opens an editor if available, otherwise returns the fallback content.

func OpenEditorWithConfig

func OpenEditorWithConfig(config EditorConfig) (string, error)

OpenEditorWithConfig is a convenience function to open an editor with custom config.

func RenderStaticSpinner

func RenderStaticSpinner(message string, completed bool, err error) string

RenderStaticSpinner renders a non-animated spinner view for non-TTY output.

func SelectIDs

func SelectIDs(title string, items []MultiSelectItem, minimum int) ([]string, error)

SelectIDs renders a shared multi-select prompt and returns selected item IDs.

func SetProgramRunner

func SetProgramRunner(runner func(run func() error) error)

SetProgramRunner configures an optional wrapper for interactive TUI program execution. Passing nil resets to direct execution.

Types

type BrowserProgram

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

BrowserProgram provides a list/detail interactive browser experience. Enter opens details for the selected item. Escape goes back to the list. Escape on the list exits the browser.

func NewBrowserProgram

func NewBrowserProgram(title string, items []PickerItem, renderDetail func(PickerItem) string) *BrowserProgram

NewBrowserProgram creates a browser program for list/detail navigation.

func (*BrowserProgram) Run

func (bp *BrowserProgram) Run() error

Run executes the browser program.

type ColorScheme

type ColorScheme struct {
	// Primary colors
	Primary   lipgloss.TerminalColor
	Secondary lipgloss.TerminalColor
	Accent    lipgloss.TerminalColor

	// Status colors
	Success lipgloss.TerminalColor
	Warning lipgloss.TerminalColor
	Error   lipgloss.TerminalColor
	Info    lipgloss.TerminalColor

	// UI colors
	Border     lipgloss.TerminalColor
	Muted      lipgloss.TerminalColor
	Background lipgloss.TerminalColor
	Foreground lipgloss.TerminalColor

	// Selection colors
	Selected   lipgloss.TerminalColor
	Unselected lipgloss.TerminalColor
	Cursor     lipgloss.TerminalColor
}

ColorScheme defines the color palette for UI components.

func DarkScheme

func DarkScheme() ColorScheme

DarkScheme returns the color scheme for dark terminals.

func DefaultScheme

func DefaultScheme() ColorScheme

DefaultScheme returns the appropriate color scheme based on terminal settings. It respects NO_COLOR environment variable.

func LightScheme

func LightScheme() ColorScheme

LightScheme returns the color scheme for light terminals.

type ConfirmModel

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

ConfirmModel represents a y/n confirmation prompt.

func NewConfirm

func NewConfirm(opts ...ConfirmOption) ConfirmModel

NewConfirm creates a new ConfirmModel.

func (ConfirmModel) Cancelled

func (m ConfirmModel) Cancelled() bool

Cancelled returns whether the prompt was cancelled.

func (ConfirmModel) Confirmed

func (m ConfirmModel) Confirmed() bool

Confirmed returns whether Yes was selected.

func (ConfirmModel) Init

func (m ConfirmModel) Init() tea.Cmd

Init initializes the confirmation model.

func (ConfirmModel) Selected

func (m ConfirmModel) Selected() bool

Selected returns the current selection (true = Yes, false = No).

func (ConfirmModel) Update

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

Update handles messages for the confirmation model.

func (ConfirmModel) View

func (m ConfirmModel) View() string

View renders the confirmation prompt.

type ConfirmOption

type ConfirmOption func(*ConfirmModel)

ConfirmOption configures a ConfirmModel.

func WithConfirmPrompt

func WithConfirmPrompt(prompt string) ConfirmOption

WithConfirmPrompt sets the confirmation prompt text.

func WithConfirmStyles

func WithConfirmStyles(styles Styles) ConfirmOption

WithConfirmStyles sets custom styles for the confirmation.

func WithDefaultNo

func WithDefaultNo() ConfirmOption

WithDefaultNo sets the default selection to No.

func WithDefaultYes

func WithDefaultYes() ConfirmOption

WithDefaultYes sets the default selection to Yes.

func WithShowButtons

func WithShowButtons() ConfirmOption

WithShowButtons enables button-style display.

type ConfirmProgram

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

ConfirmProgram wraps a ConfirmModel in a tea.Program for standalone use.

func NewConfirmProgram

func NewConfirmProgram(opts ...ConfirmOption) *ConfirmProgram

NewConfirmProgram creates a new confirmation program for standalone operation.

func (*ConfirmProgram) Run

func (cp *ConfirmProgram) Run() (confirmed bool, cancelled bool, err error)

Run runs the confirmation program and returns the result.

type ConfirmResultMsg

type ConfirmResultMsg struct {
	Confirmed bool
	Cancelled bool
}

ConfirmResultMsg is sent when the confirmation is resolved.

type Editor

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

Editor provides functionality to open an external editor.

func NewEditor

func NewEditor(config EditorConfig) (*Editor, error)

NewEditor creates a new Editor instance.

func (*Editor) Edit

func (e *Editor) Edit() (string, error)

Edit opens the editor with the initial content and returns the edited content.

func (*Editor) FilePath

func (e *Editor) FilePath() string

FilePath returns the path of the temp file (useful if DeleteOnClose is false).

type EditorConfig

type EditorConfig struct {
	// Extension is the file extension for the temp file (default: ".md")
	Extension string

	// InitialContent is the initial content to show in the editor
	InitialContent string

	// Prefix is a prefix for the temp file name
	Prefix string

	// AllowEmpty if true, allows empty content to be returned
	AllowEmpty bool

	// DeleteOnClose if true, deletes the temp file after editing
	DeleteOnClose bool
}

EditorConfig configures the editor behavior.

func DefaultEditorConfig

func DefaultEditorConfig() EditorConfig

DefaultEditorConfig returns the default editor configuration.

type InputCancelMsg

type InputCancelMsg struct{}

InputCancelMsg is sent when the input is cancelled.

type InputModel

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

InputModel represents a styled text input with validation support.

func NewInput

func NewInput(opts ...InputOption) InputModel

NewInput creates a new InputModel.

func (*InputModel) Blur

func (m *InputModel) Blur()

Blur removes focus from the input.

func (InputModel) Cancelled

func (m InputModel) Cancelled() bool

Cancelled returns whether the input was cancelled.

func (InputModel) Error

func (m InputModel) Error() error

Error returns any validation error.

func (*InputModel) Focus

func (m *InputModel) Focus() tea.Cmd

Focus focuses the input.

func (InputModel) Init

func (m InputModel) Init() tea.Cmd

Init initializes the input model.

func (*InputModel) Reset

func (m *InputModel) Reset()

Reset resets the input state.

func (*InputModel) SetValue

func (m *InputModel) SetValue(value string)

SetValue sets the input value.

func (InputModel) Submitted

func (m InputModel) Submitted() bool

Submitted returns whether the input was submitted.

func (InputModel) Update

func (m InputModel) Update(msg tea.Msg) (InputModel, tea.Cmd)

Update handles messages for the input model.

func (InputModel) Value

func (m InputModel) Value() string

Value returns the current input value.

func (InputModel) View

func (m InputModel) View() string

View renders the input.

type InputOption

type InputOption func(*InputModel)

InputOption configures an InputModel.

func WithCharLimit

func WithCharLimit(limit int) InputOption

WithCharLimit sets the character limit.

func WithInitialValue

func WithInitialValue(value string) InputOption

WithInitialValue sets the initial input value.

func WithInputStyles

func WithInputStyles(styles Styles) InputOption

WithInputStyles sets custom styles for the input.

func WithMasked

func WithMasked() InputOption

WithMasked enables password masking mode.

func WithMultiline

func WithMultiline(height int) InputOption

WithMultiline enables wrapped multiline input.

func WithPlaceholder

func WithPlaceholder(placeholder string) InputOption

WithPlaceholder sets the placeholder text.

func WithPrompt

func WithPrompt(prompt string) InputOption

WithPrompt sets the input prompt text.

func WithValidation

func WithValidation(fn ValidationFunc) InputOption

WithValidation sets the validation function.

func WithWidth

func WithWidth(width int) InputOption

WithWidth sets the input width.

type InputProgram

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

InputProgram wraps an InputModel in a tea.Program for standalone use.

func NewInputProgram

func NewInputProgram(opts ...InputOption) *InputProgram

NewInputProgram creates a new input program for standalone operation.

func (*InputProgram) Run

func (ip *InputProgram) Run() (string, error)

Run runs the input program and returns the entered value.

func (*InputProgram) RunWithCancel

func (ip *InputProgram) RunWithCancel() (value string, cancelled bool, err error)

RunWithCancel runs the input program and returns the entered value and cancellation status.

type InputSubmitMsg

type InputSubmitMsg struct {
	Value string
}

InputSubmitMsg is sent when the input is submitted.

type MultiSelectCancelMsg

type MultiSelectCancelMsg struct{}

MultiSelectCancelMsg is sent when the multi-select is cancelled.

type MultiSelectItem

type MultiSelectItem struct {
	ID     string
	Label  string
	Detail string
	Icon   string
}

MultiSelectItem represents a selection candidate used by shared multi-select helpers.

type MultiSelectModel

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

MultiSelectModel represents a multi-select picker with fuzzy search filtering.

func NewMultiSelect

func NewMultiSelect(opts ...MultiSelectOption) MultiSelectModel

NewMultiSelect creates a new MultiSelectModel.

func (MultiSelectModel) Cancelled

func (m MultiSelectModel) Cancelled() bool

Cancelled returns whether the selection was cancelled.

func (MultiSelectModel) Init

func (m MultiSelectModel) Init() tea.Cmd

Init initializes the multi-select model.

func (MultiSelectModel) Items

func (m MultiSelectModel) Items() []PickerItem

Items returns all items.

func (MultiSelectModel) SelectedItems

func (m MultiSelectModel) SelectedItems() []PickerItem

SelectedItems returns all selected items.

func (*MultiSelectModel) SetItems

func (m *MultiSelectModel) SetItems(items []PickerItem)

SetItems updates the items and resets the filter.

func (MultiSelectModel) Submitted

func (m MultiSelectModel) Submitted() bool

Submitted returns whether the selection was confirmed.

func (MultiSelectModel) Update

func (m MultiSelectModel) Update(msg tea.Msg) (MultiSelectModel, tea.Cmd)

Update handles messages for the multi-select model.

func (MultiSelectModel) View

func (m MultiSelectModel) View() string

View renders the multi-select.

type MultiSelectOption

type MultiSelectOption func(*MultiSelectModel)

MultiSelectOption configures a MultiSelectModel.

func WithMultiSelectHeight

func WithMultiSelectHeight(height int) MultiSelectOption

WithMultiSelectHeight sets the maximum visible items.

func WithMultiSelectItems

func WithMultiSelectItems(items []PickerItem) MultiSelectOption

WithMultiSelectItems sets the initial items.

func WithMultiSelectMaximum

func WithMultiSelectMaximum(max int) MultiSelectOption

WithMultiSelectMaximum sets the maximum allowed selections.

func WithMultiSelectMinimum

func WithMultiSelectMinimum(min int) MultiSelectOption

WithMultiSelectMinimum sets the minimum required selections.

func WithMultiSelectSearch

func WithMultiSelectSearch(enabled bool) MultiSelectOption

WithMultiSelectSearch enables or disables the search input.

func WithMultiSelectStyles

func WithMultiSelectStyles(styles Styles) MultiSelectOption

WithMultiSelectStyles sets custom styles.

func WithMultiSelectTitle

func WithMultiSelectTitle(title string) MultiSelectOption

WithMultiSelectTitle sets the title.

func WithPreselected

func WithPreselected(ids []string) MultiSelectOption

WithPreselected marks specific items as selected by their IDs.

type MultiSelectProgram

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

MultiSelectProgram wraps a MultiSelectModel in a tea.Program for standalone use.

func NewMultiSelectProgram

func NewMultiSelectProgram(opts ...MultiSelectOption) *MultiSelectProgram

NewMultiSelectProgram creates a new multi-select program for standalone operation.

func (*MultiSelectProgram) Run

func (mp *MultiSelectProgram) Run() ([]PickerItem, error)

Run runs the multi-select program and returns the selected items.

type MultiSelectResultMsg

type MultiSelectResultMsg struct {
	Items []PickerItem
}

MultiSelectResultMsg is sent when the multi-select is confirmed.

type PickerCancelMsg

type PickerCancelMsg struct{}

PickerCancelMsg is sent when the picker is cancelled.

type PickerItem

type PickerItem struct {
	ID       string // Unique identifier
	Label    string // Display text
	Detail   string // Additional detail (displayed after label)
	Icon     string // Optional icon prefix
	Selected bool   // For multi-select mode
	Value    any    // Optional associated value
}

PickerItem represents an item in the picker.

func SelectOne

func SelectOne(title string, items []PickerItem) (*PickerItem, error)

SelectOne renders a searchable single-select picker and returns the selected item.

type PickerModel

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

PickerModel represents a list picker with fuzzy search filtering.

func NewPicker

func NewPicker(opts ...PickerOption) PickerModel

NewPicker creates a new PickerModel.

func (PickerModel) Cancelled

func (m PickerModel) Cancelled() bool

Cancelled returns whether the picker was cancelled.

func (PickerModel) Init

func (m PickerModel) Init() tea.Cmd

Init initializes the picker model.

func (PickerModel) Items

func (m PickerModel) Items() []PickerItem

Items returns all items.

func (PickerModel) SelectedItem

func (m PickerModel) SelectedItem() *PickerItem

SelectedItem returns the currently highlighted item, or nil if none.

func (*PickerModel) SetItems

func (m *PickerModel) SetItems(items []PickerItem)

SetItems updates the items and resets the filter.

func (PickerModel) Submitted

func (m PickerModel) Submitted() bool

Submitted returns whether an item was selected.

func (PickerModel) Update

func (m PickerModel) Update(msg tea.Msg) (PickerModel, tea.Cmd)

Update handles messages for the picker model.

func (PickerModel) View

func (m PickerModel) View() string

View renders the picker.

type PickerOption

type PickerOption func(*PickerModel)

PickerOption configures a PickerModel.

func WithPickerHeight

func WithPickerHeight(height int) PickerOption

WithPickerHeight sets the maximum visible items.

func WithPickerItems

func WithPickerItems(items []PickerItem) PickerOption

WithPickerItems sets the initial items.

func WithPickerSearch

func WithPickerSearch(enabled bool) PickerOption

WithPickerSearch enables or disables the search input.

func WithPickerStyles

func WithPickerStyles(styles Styles) PickerOption

WithPickerStyles sets custom styles.

func WithPickerTitle

func WithPickerTitle(title string) PickerOption

WithPickerTitle sets the picker title.

type PickerProgram

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

PickerProgram wraps a PickerModel in a tea.Program for standalone use.

func NewPickerProgram

func NewPickerProgram(opts ...PickerOption) *PickerProgram

NewPickerProgram creates a new picker program for standalone operation.

func (*PickerProgram) Run

func (pp *PickerProgram) Run() (*PickerItem, error)

Run runs the picker program and returns the selected item.

type PickerSelectMsg

type PickerSelectMsg struct {
	Item PickerItem
}

PickerSelectMsg is sent when an item is selected.

type SpinnerCompleteStepMsg

type SpinnerCompleteStepMsg struct {
	Error error
}

SpinnerCompleteStepMsg marks the current step as completed.

type SpinnerDoneMsg

type SpinnerDoneMsg struct {
	Error error
}

SpinnerDoneMsg signals that the spinner should stop.

type SpinnerModel

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

SpinnerModel represents a progress spinner with optional multi-step display.

func NewSpinner

func NewSpinner(opts ...SpinnerOption) SpinnerModel

NewSpinner creates a new SpinnerModel.

func (*SpinnerModel) AddStep

func (m *SpinnerModel) AddStep(msg string)

AddStep adds a new step to the multi-step progress display.

func (*SpinnerModel) CompleteStep

func (m *SpinnerModel) CompleteStep(err error)

CompleteStep marks the current step as completed.

func (SpinnerModel) Done

func (m SpinnerModel) Done() bool

Done returns whether the spinner has completed.

func (SpinnerModel) Error

func (m SpinnerModel) Error() error

Error returns any error that occurred.

func (*SpinnerModel) Finish

func (m *SpinnerModel) Finish(err error)

Finish marks the spinner as done.

func (SpinnerModel) Init

func (m SpinnerModel) Init() tea.Cmd

Init initializes the spinner model.

func (*SpinnerModel) SetMessage

func (m *SpinnerModel) SetMessage(msg string)

SetMessage sets the current message.

func (SpinnerModel) Update

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

Update handles messages for the spinner model.

func (SpinnerModel) View

func (m SpinnerModel) View() string

View renders the spinner.

type SpinnerOption

type SpinnerOption func(*SpinnerModel)

SpinnerOption configures a SpinnerModel.

func WithMessage

func WithMessage(msg string) SpinnerOption

WithMessage sets the initial message.

func WithSpinnerStyle

func WithSpinnerStyle(s spinner.Spinner) SpinnerOption

WithSpinnerStyle sets the spinner animation style.

func WithStyles

func WithStyles(styles Styles) SpinnerOption

WithStyles sets custom styles for the spinner.

type SpinnerProgram

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

SpinnerProgram wraps a SpinnerModel in a tea.Program for standalone use.

func NewSpinnerProgram

func NewSpinnerProgram(opts ...SpinnerOption) *SpinnerProgram

NewSpinnerProgram creates a new spinner program for standalone operation.

func (*SpinnerProgram) AddStep

func (sp *SpinnerProgram) AddStep(msg string)

AddStep adds a new step to the spinner.

func (*SpinnerProgram) CompleteStep

func (sp *SpinnerProgram) CompleteStep(err error)

CompleteStep completes the current step.

func (*SpinnerProgram) Done

func (sp *SpinnerProgram) Done(err error)

Done signals completion and stops the spinner.

func (*SpinnerProgram) Start

func (sp *SpinnerProgram) Start() error

Start starts the spinner program in the background.

func (*SpinnerProgram) UpdateMessage

func (sp *SpinnerProgram) UpdateMessage(msg string)

UpdateMessage sends a message update to the spinner.

func (*SpinnerProgram) Wait

func (sp *SpinnerProgram) Wait() error

Wait blocks until the program exits.

type SpinnerStep

type SpinnerStep struct {
	Message   string
	Completed bool
	Error     error
}

SpinnerStep represents a single step in a multi-step progress display.

type SpinnerStepMsg

type SpinnerStepMsg struct {
	Message string
}

SpinnerStepMsg adds a new step to the spinner.

type SpinnerUpdateMsg

type SpinnerUpdateMsg string

SpinnerUpdateMsg updates the spinner message.

type Styles

type Styles struct {

	// Base styles
	Base lipgloss.Style

	// Title and header styles
	Title    lipgloss.Style
	Subtitle lipgloss.Style
	Header   lipgloss.Style

	// Content styles
	Normal    lipgloss.Style
	Bold      lipgloss.Style
	Muted     lipgloss.Style
	Highlight lipgloss.Style

	// Status styles
	Success lipgloss.Style
	Warning lipgloss.Style
	Error   lipgloss.Style
	Info    lipgloss.Style

	// List/Picker styles
	ListItem         lipgloss.Style
	ListItemSelected lipgloss.Style
	ListCursor       lipgloss.Style

	// Input styles
	InputPrompt      lipgloss.Style
	InputText        lipgloss.Style
	InputPlaceholder lipgloss.Style

	// Border styles
	BorderedBox lipgloss.Style

	// Spinner styles
	Spinner lipgloss.Style

	// Button styles
	ButtonActive   lipgloss.Style
	ButtonInactive lipgloss.Style

	// Checkbox styles
	CheckboxChecked   lipgloss.Style
	CheckboxUnchecked lipgloss.Style

	// Help styles
	HelpKey  lipgloss.Style
	HelpDesc lipgloss.Style
	// contains filtered or unexported fields
}

Styles provides a collection of reusable Lipgloss styles.

func DefaultStyles

func DefaultStyles() Styles

DefaultStyles returns a new Styles instance with the default color scheme.

func NewStyles

func NewStyles(scheme ColorScheme) Styles

NewStyles creates a new Styles instance with the given color scheme.

func (Styles) Scheme

func (s Styles) Scheme() ColorScheme

Scheme returns the color scheme used by these styles.

type ValidationFunc

type ValidationFunc func(value string) error

ValidationFunc is a function that validates input and returns an error message if invalid.

Jump to

Keyboard shortcuts

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