Documentation
¶
Index ¶
- Variables
- type Decision
- type KeyMap
- type Model
- func (m *Model) Init() tea.Cmd
- func (m *Model) IsAccepted() bool
- func (m *Model) IsDenied() bool
- func (m *Model) IsUndecided() bool
- func (m *Model) Selected() Decision
- func (m *Model) SetDecision(decision Decision)
- func (m *Model) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (m *Model) Value() string
- func (m *Model) View() string
- type Rendering
- type Styles
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Decision ¶
type Decision int
Decision is an enumeration of decisions available in the confirmation bubble
const ( // Undecided indicates the state in which a user has not made a selection, and there is no default available Undecided Decision = iota // Accepted indicates the user has provided a positive response (accepted confirmation) Accepted // Denied indicates the user has provided a negative response (denied confirmation) Denied )
func (Decision) TrueFalseString ¶
TrueFalseString represents Decision in undecided/true/false format
func (Decision) YesNoString ¶
YesNoString represents Decision in undecided/yes/no format
type KeyMap ¶
KeyMap defines the key bindings for selectable renderings
type Model ¶
type Model struct {
// PromptPrefix is a character or other indicator existing before the user prompt, separately styled
PromptPrefix string
// Prompt is the text to display to the user, prompting them for input
Prompt string
// Placeholder is text used only when rendering as InputBox, providing help-like text to the user
Placeholder string
// AcceptedDecisionText is the text to display to a user which they will select for Accepted confirmations
AcceptedDecisionText string
// DeniedDecisionText is the text to display to a user which they will select for Denied confirmations
DeniedDecisionText string
// ChooserIndicator is a rune displayed to the user for HorizontalSelection or VerticalSelection rendering
ChooserIndicator rune
// DefaultValue allows the caller to define the initially selected value
DefaultValue Decision
// Rendering provides options for modified rendering
Rendering Rendering
// Styles is the group of available styles
Styles Styles
// ShowHelp determines whether to show help where possible (e.g. HorizontalSelection or VerticalSelection rendering)
ShowHelp bool
// contains filtered or unexported fields
}
Model represents the bubble tea model for the confirm bubble
func (*Model) IsAccepted ¶
IsAccepted is a helper to indicate the positive confirmation state was selected
func (*Model) IsDenied ¶
IsDenied is a helper to indicate the negative confirmation state was selected
func (*Model) IsUndecided ¶
IsUndecided is a helper to indicate in cases where no default was provided, the user made no choice
func (*Model) SetDecision ¶
SetDecision allows for externally setting the decision to a supported value
type Rendering ¶
type Rendering int
Rendering is an enumeration of available renderings, allowing modification of the bubble's view output
const ( // InputBox defines rendering as standard format: Prompt? Y/n // The user would then enter the desired character and hit enter. InputBox Rendering = iota // HorizontalSelection defines rendering as a left->right looping toggle: Prompt? ➤Y N HorizontalSelection // VerticalSelection defines rendering as a up->down looping toggle: // Prompt? // ➤Y // N VerticalSelection )
type Styles ¶
type Styles struct {
PromptPrefix lipgloss.Style
Prompt lipgloss.Style
Text lipgloss.Style
Placeholder lipgloss.Style
ChooserIndicator lipgloss.Style
}
Styles holds relevant styles used for rendering For an introduction to styling with Lip Gloss see: https://github.com/charmbracelet/lipgloss