Help us shape the future of Go! Take the 2026 Go Developer Survey

dialog

package
v0.0.0-...-63b292e Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AnswerCmd

func AnswerCmd(ask AskMsg, answerIdx int) tea.Cmd

AnswerCmd returns a command that sends an AnswerMsg with the given ask and answer.

Types

type AnswerMsg

type AnswerMsg struct {
	AskMsg
	// contains filtered or unexported fields
}

AnswerMsg represents a message that contains the index of the selected answer and implements the AskMsg interface.

func (AnswerMsg) Answer

func (a AnswerMsg) Answer() string

Answer returns the selected answer.

func (AnswerMsg) AnswerIdx

func (a AnswerMsg) AnswerIdx() int

AnswerIdx returns the index of the selected answer.

type AskMsg

type AskMsg interface {
	ID() string
	Message() string
	Options() []string
}

AskMsg represents a message that asks a question and has a list of options.

type Dialog

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

Dialog is a model that represents a dialog box that will display a question and and provide buttons for the user to select an answer. It accepts tea.msg objects that implements the AskMsg interface.

func NewDialog

func NewDialog(btnStyle lipgloss.Style, wrapperStyle lipgloss.Style) *Dialog

NewDialog creates a new dialog box

func (*Dialog) Blur

func (m *Dialog) Blur()

Blur freezes the model, preventing selection or movement

func (*Dialog) Focus

func (m *Dialog) Focus()

Focus focuses the model, allowing interaction

func (*Dialog) Focused

func (m *Dialog) Focused() bool

Focused returns the focus state of the model

func (*Dialog) Init

func (d *Dialog) Init() tea.Cmd

Init initializes the dialog box. It is called by the bubbletea framework.

func (*Dialog) SetHeight

func (d *Dialog) SetHeight(height int)

SetHeight sets the height of the dialog box

func (*Dialog) SetWidth

func (d *Dialog) SetWidth(width int)

SetWidth sets the width of the dialog box

func (*Dialog) Update

func (d *Dialog) Update(msg tea.Msg) (*Dialog, tea.Cmd)

Update updates the dialog box. It is called by the bubbletea framework.

func (*Dialog) View

func (d *Dialog) View() string

View renders the dialog box. It is called by the bubbletea framework.

Jump to

Keyboard shortcuts

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