input

package
v0.0.0-...-8079059 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Showcase

func Showcase()

Showcase demonstrates all features of the Model component by creating an input model with autocomplete suggestions and running an interactive example in the terminal.

Types

type Model

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

Model is the model handling user input.

func New

func New() *Model

New creates and returns a new Model with default settings.

func (*Model) Canceled

func (m *Model) Canceled() bool

Canceled returns the canceled flag.

func (*Model) Init

func (m *Model) Init() tea.Cmd

Init initializes the Model, resets the abort flag, and returns a nil command.

func (*Model) Quit

func (m *Model) Quit() bool

Quit returns the quit flag.

func (*Model) Update

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

Update handles user input and updates the input state by processing key messages and updating the text input model accordingly.

func (*Model) View

func (m *Model) View() string

View renders the input widget as a string, displaying the prompt, text input, and help view for key bindings.

func (*Model) WithCancel

func (m *Model) WithCancel(cancelable bool) *Model

WithCancel sets the cancelable flag and returns a new Model with the updated flag.

func (*Model) WithCharLimit

func (m *Model) WithCharLimit(n int) *Model

WithCharLimit sets the maximum allowed number of input characters and returns a new Model with the updated character limit.

func (*Model) WithCursorStyle

func (m *Model) WithCursorStyle(style lipgloss.Style) *Model

WithCursorStyle sets the style of the cursor for the text input model and returns a new Model with the updated cursor style.

func (*Model) WithPlaceholder

func (m *Model) WithPlaceholder(s string) *Model

WithPlaceholder sets the placeholder for the text input model and returns a new Model with the updated placeholder.

func (*Model) WithPrompt

func (m *Model) WithPrompt(s string) *Model

WithPrompt sets the prompt for the text input model and returns a new Model with the updated prompt.

func (*Model) WithPromptStyle

func (m *Model) WithPromptStyle(style lipgloss.Style) *Model

WithPromptStyle sets the style of the prompt for the text input model and returns a new Model with the updated prompt style.

func (*Model) WithQuit

func (m *Model) WithQuit(quitable bool) *Model

WithQuit sets the quitable flag and returns a new Model with the updated flag.

func (*Model) WithSuggestion

func (m *Model) WithSuggestion(suggestions []string) *Model

WithSuggestion sets the autocomplete suggestions for the text input model and returns a new Model with the updated suggestions.

func (*Model) WithWidth

func (m *Model) WithWidth(n int) *Model

WithWidth sets the width of the text input model and returns a new Model with the updated width.

Jump to

Keyboard shortcuts

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