confirm

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package confirm provides a simple confirmation dialog component

Index

Constants

This section is empty.

Variables

View Source
var (
	InactiveButtonStyle = lipgloss.NewStyle().
		Foreground(colors.InactiveButtonFg).
		Background(colors.InactiveButtonBg).
		Padding(buttonPadding...).
		Margin(buttonMargin...)
)
View Source
var Keys = KeyMap{
	Toggle: key.NewBinding(
		key.WithKeys("tab", "h", "l", "left", "right"),
		key.WithHelp("", "toggle"),
	),
	Confirm: key.NewBinding(
		key.WithKeys("y"),
		key.WithHelp("y", "confirm"),
	),
	Cancel: key.NewBinding(
		key.WithKeys("n"),
		key.WithHelp("n", "cancel"),
	),
	Submit: key.NewBinding(
		key.WithKeys("enter"),
		key.WithHelp("enter", "submit"),
	),
	ShortSession: key.NewBinding(
		key.WithKeys("s"),
		key.WithHelp("s", "short session"),
	),
	Quit: key.NewBinding(
		key.WithKeys("ctrl+c", "q"),
		key.WithHelp("q", "quit"),
	),
}

Functions

This section is empty.

Types

type ChoiceMsg added in v0.8.1

type ChoiceMsg struct {
	Choice ConfirmChoice
}

type ConfirmChoice added in v0.8.1

type ConfirmChoice int
const (
	Confirm ConfirmChoice = iota
	Cancel
	ShortSession
)

type KeyMap

type KeyMap struct {
	Toggle       key.Binding
	Confirm      key.Binding
	Cancel       key.Binding
	Submit       key.Binding
	ShortSession key.Binding
	Quit         key.Binding
}

func (KeyMap) FullHelp

func (k KeyMap) FullHelp() [][]key.Binding

func (KeyMap) ShortHelp

func (k KeyMap) ShortHelp() []key.Binding

type Model

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

func New

func New() Model

func (Model) Choice added in v0.8.1

func (m Model) Choice(choice ConfirmChoice) tea.Cmd

func (*Model) HandleKeys added in v0.8.1

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

func (*Model) HandleWindowResize added in v0.8.1

func (m *Model) HandleWindowResize(msg tea.WindowSizeMsg) tea.Cmd

func (Model) View

func (m Model) View(prompt string) string

Jump to

Keyboard shortcuts

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