popup

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2023 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Choice

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

Choice is a popup that presents a yes/no choice to the user.

func NewChoice

func NewChoice(colors *theme.Colors, bgRaw string, width int, question string, defaultChoice bool) Choice

NewChoice creates a new Choice popup.

func (Choice) Init

func (c Choice) Init() tea.Cmd

Init initializes the popup.

func (Choice) Update

func (c Choice) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update handles messages.

func (Choice) View

func (c Choice) View() string

View renders the popup.

type ChoiceResultMsg

type ChoiceResultMsg struct {
	Result bool
}

ChoiceResultMsg is the message sent when a choice is made.

type Default

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

Default is a default popup window.

func New

func New(bgRaw string, width, height int) Default

New creates a new default popup window.

func (Default) Height

func (p Default) Height() int

Height returns the height of the popup window.

func (Default) Overlay

func (p Default) Overlay(text string) string

Overlay overlays the given text on top of the background.

func (Default) Width

func (p Default) Width() int

Width returns the width of the popup window.

type Popup interface {
	tea.Model
}

Popup is the popup window interface. In can be implemented in other packages and use the `Default` popup to overlay the content on top of the background.

Jump to

Keyboard shortcuts

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