Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
QuitTextStyle = lipgloss.NewStyle().Margin(1, 0, 2, 4)
)
Functions ¶
This section is empty.
Types ¶
type Model ¶
type Model struct {
// Style configures the style applied to all rendering for the prompt. This can be used to apply padding and borders.
Style lipgloss.Style
// ErrStyle configures the style applied to error messages.
ErrStyle lipgloss.Style
// Quitting indicates whether the prompt has been canceled.
Quitting bool
// contains filtered or unexported fields
}
Model is text model for bubble tea.
func NewTextModel ¶
func NewTextModel(prompt string, options TextModelOptions) Model
NewTextModel creates a new Model struct with a textinput field, a prompt string, and options for the textinput field such as placeholder and echo mode, and sets the default style and error style for the Model.
func (Model) GetValue ¶
GetValue returns the input from the user, or the default value if the user did not enter anything.
type TextModelOptions ¶
type TextModelOptions struct {
// Default sets a default value for the user input.
Default string
// Placeholder sets a placeholder for the user input.
Placeholder string
// Validate defines a validator for the user input.
Validate func(string) error
// EchoMode indicates the input behavior of the text input field (e.g. password).
EchoMode textinput.EchoMode
}
TextModelOptions contains options for the text model.
Click to show internal directories.
Click to hide internal directories.