input

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2023 License: MIT Imports: 6 Imported by: 25

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

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 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() any

func (Model) DataString

func (m Model) DataString() string

func (Model) Init

func (m Model) Init() tea.Cmd

func (Model) KeyBindings

func (m Model) KeyBindings() []key.Binding

func (Model) Update

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

func (Model) UseKeyEnter

func (m Model) UseKeyEnter() bool

func (Model) UseKeyQ

func (m Model) UseKeyQ() bool

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 WithInputMode

func WithInputMode(mode InputMode) Option

func WithValidateFunc

func WithValidateFunc(vf ValidateFunc) 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