inputmodels

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HelpStyle

func HelpStyle(str string) string

func NewRadioSelect

func NewRadioSelect(options RadioSelectOptions) radioSelect

func NewTextInput

func NewTextInput(options TextInputOptions) textInput

func NewchoiceModel

func NewchoiceModel(opts ChoiceModelOptions) choiceModel

Types

type ChoiceModelOptions

type ChoiceModelOptions struct {
	Choices []string
	// the value you wish to receive for every choice, in the same order
	Values  []string
	Header  string
	Next    func() (tea.Model, tea.Cmd)
	OnEnter func(selected []Selection) error
}

type RadioSelectOptions

type RadioSelectOptions struct {
	CursorStartingPosition int
	Choices                []string
	// Values is a map of the choices to their values
	Values  []string
	Header  string
	OnEnter func(selection string, cursorPosition int) error
	Next    func() (tea.Model, tea.Cmd)
}

type Selection

type Selection struct {
	IsSelected bool
	// contains filtered or unexported fields
}

func (Selection) Value

func (s Selection) Value() string

type TextInputOptions

type TextInputOptions struct {
	Header       string
	Placeholder  string
	OnEnter      func(input string) error
	OnEnterEmpty func() error
	Next         func() (tea.Model, tea.Cmd)
	NextEmpty    func() (tea.Model, tea.Cmd)
}

Jump to

Keyboard shortcuts

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