dialog

package
v0.0.0-...-692cb10 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Kind

type Kind int

Kind identifies the dialog type.

const (
	KindConfirm Kind = iota
	KindInput
	KindProgress
	KindError
)

type Model

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

Model represents a modal dialog overlaid on the panels.

func NewConfirm

func NewConfirm(title, message, tag string) Model

NewConfirm creates a Yes/No confirmation dialog.

func NewError

func NewError(title, message string) Model

NewError creates an error display dialog.

func NewInput

func NewInput(title, message, defaultValue, tag string) Model

NewInput creates a text input dialog.

func NewInputWithBase

func NewInputWithBase(title, message, defaultValue, tag, basePath string) Model

func NewProgress

func NewProgress(title, tag string) Model

NewProgress creates a progress dialog.

func (Model) BoxSize

func (m Model) BoxSize(screenWidth, screenHeight int) (int, int)

BoxSize returns desired box dimensions.

func (*Model) Close

func (m *Model) Close()

Close dismisses the dialog (used for progress dialogs when the operation ends).

func (Model) Done

func (m Model) Done() bool

Done returns true when the dialog has been dismissed.

func (Model) GetResult

func (m Model) GetResult() Result

GetResult returns the dialog result.

func (*Model) SetProgress

func (m *Model) SetProgress(progress float64, current string)

SetProgress updates the progress dialog state.

func (*Model) Update

func (m *Model) Update(msg tea.KeyMsg) tea.Cmd

Update handles key events for the dialog.

func (Model) View

func (m Model) View(th theme.Theme, screenWidth, screenHeight int) string

View renders the dialog as a floating box using the shared overlay style.

type Result

type Result struct {
	Kind      Kind
	Confirmed bool   // for confirm dialogs
	Text      string // for input dialogs
	Tag       string // caller-defined tag to identify which operation triggered the dialog
}

Result is sent when a dialog closes.

Jump to

Keyboard shortcuts

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