dialog

package
v1.3.7 Latest Latest
Warning

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

Go to latest
Published: May 11, 2026 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package dialog is a modal yes/no confirmation dialog TUI component.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyTheme

func ApplyTheme(accent, text, dim lipgloss.Color)

ApplyTheme updates button styles to match the active theme.

Types

type ButtonOpts

type ButtonOpts struct {
	Text           string
	UnderlineIndex int // char index to underline as mnemonic; -1 to disable
}

ButtonOpts configures a single dialog button.

type CancelMsg

type CancelMsg struct{}

CancelMsg is dispatched when the user presses Esc.

type ConfirmMsg

type ConfirmMsg struct {
	ButtonIndex int
	ButtonText  string
}

ConfirmMsg is dispatched when the user confirms a button selection.

type Model

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

Model is the dialog modal component.

func New

func New(title, body string, buttons []ButtonOpts, w, h int) Model

New creates a dialog with the given title, body, and buttons.

func (*Model) SetSize

func (m *Model) SetSize(w, h int)

SetSize updates the dialog dimensions.

func (Model) Update

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

Update handles key events for button navigation and confirmation.

func (Model) View

func (m Model) View() string

View renders the dialog content (without outer border).

Jump to

Keyboard shortcuts

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