dialog

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: May 30, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Close

func Close() tea.Cmd

func Show

func Show(content Content, onCloseCmd tea.Cmd, displayMode DisplayMode) tea.Cmd

Show creates a tea.Cmd to show a dialog with the given content.

Types

type CloseMsg

type CloseMsg struct{}

type Content

type Content interface {
	Init() tea.Cmd
	Update(msg tea.Msg) (Content, tea.Cmd)
	View() string
	SetSize(width, height int) Content
	Help() []key.Binding
}

Content describes UI elements that can be displayed inside a dialog.

type DisplayMode

type DisplayMode byte
const (
	CenterDisplayMode DisplayMode = iota
	FullScreenDisplayMode
)

type Model

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

func New

func New(content Content, onCloseCmd tea.Cmd, displayMode DisplayMode) Model

func (Model) FullHelp

func (m Model) FullHelp() [][]key.Binding

func (Model) Init

func (m Model) Init() tea.Cmd

func (Model) OnCloseCmd

func (m Model) OnCloseCmd() tea.Cmd

func (Model) SetSize

func (m Model) SetSize(width, height int) Model

func (Model) ShortHelp

func (m Model) ShortHelp() []key.Binding

func (Model) Update

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

func (Model) View

func (m Model) View() string

type ShowMsg

type ShowMsg struct {
	Dialog Model
}

Jump to

Keyboard shortcuts

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