input

package
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2023 License: MIT Imports: 7 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultKeyMap = KeyMap{
	Confirm: key.NewBinding(
		key.WithKeys("enter"),
		key.WithHelp("enter", "confirm"),
	),
	Quit: key.NewBinding(
		key.WithKeys("esc", "ctrl+c"),
		key.WithHelp("esc", "quit"),
	),
}

Functions

This section is empty.

Types

type EchoMode

type EchoMode = textinput.EchoMode
const (
	// EchoNormal displays text as is. This is the default behavior.
	EchoNormal EchoMode = textinput.EchoNormal

	// EchoPassword displays the EchoCharacter mask instead of actual
	// characters.  This is commonly used for password fields.
	EchoPassword EchoMode = textinput.EchoPassword

	// EchoNone displays nothing as characters are entered. This is commonly
	// seen for password fields on the command line.
	EchoNone EchoMode = textinput.EchoNone
)

type InputMode

type InputMode int
const (
	InputAll     InputMode = iota // allow any input.
	InputInteger                  // only integers can be entered.
	InputNumber                   // only integers and decimals can be entered.
)

type KeyMap added in v0.8.1

type KeyMap struct {
	Confirm key.Binding
	Quit    key.Binding
}

func (KeyMap) FullHelp added in v0.8.1

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

func (KeyMap) ShortHelp added in v0.8.1

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

type Model

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

func New

func New(defaultValue string, opts ...Option) *Model

func (Model) Data

func (m Model) Data() string

func (Model) DataString

func (m Model) DataString() string

func (Model) Error added in v0.8.0

func (m Model) Error() error

func (Model) Init

func (m Model) Init() tea.Cmd

func (Model) Quitting added in v0.8.0

func (m Model) Quitting() bool

func (Model) TeaProgramOpts added in v0.8.4

func (m Model) TeaProgramOpts() []tea.ProgramOption

func (Model) Update

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

func (Model) View

func (m Model) View() string

func (*Model) WithEchoMode

func (m *Model) WithEchoMode(mode EchoMode) *Model

func (*Model) WithInputMode

func (m *Model) WithInputMode(mode InputMode) *Model

func (*Model) WithValidateFunc

func (m *Model) WithValidateFunc(vf ValidateFunc) *Model

type Option

type Option func(*Model)

func WithEchoMode

func WithEchoMode(mode EchoMode) Option

func WithHelp added in v0.8.0

func WithHelp(show bool) Option

func WithInputMode

func WithInputMode(mode InputMode) Option

func WithKeyMap added in v0.8.1

func WithKeyMap(keyMap KeyMap) Option

func WithTeaProgramOpts added in v0.8.4

func WithTeaProgramOpts(opts ...tea.ProgramOption) Option

func WithValidateFunc

func WithValidateFunc(vf ValidateFunc) Option

func WithWidth added in v0.8.3

func WithWidth(width int) Option

type ValidateFunc

type ValidateFunc func(string) error

Jump to

Keyboard shortcuts

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