Documentation ¶
Index ¶
- func Start() tea.Msg
- type ChoiceField
- func (m *ChoiceField) Disable()
- func (m *ChoiceField) Enable()
- func (m ChoiceField) Enabled() bool
- func (m ChoiceField) Hidden() bool
- func (m *ChoiceField) Hide()
- func (m *ChoiceField) SetEnabled(enabled bool)
- func (m *ChoiceField) SetHidden(hidden bool)
- func (m *ChoiceField) Show()
- func (m ChoiceField) Update(msg tea.Msg) (ChoiceField, tea.Cmd)
- func (m ChoiceField) Validate() tea.Cmd
- func (m ChoiceField) View() string
- type ChoiceFieldValidator
- type CompletionModel
- type Completions
- type ContainerImage
- type ExitField
- func (m *ExitField) Blur()
- func (m *ExitField) Disable()
- func (m *ExitField) Enable()
- func (m ExitField) Enabled() bool
- func (m *ExitField) Focus()
- func (m ExitField) Focused() bool
- func (m ExitField) Hidden() bool
- func (m *ExitField) Hide()
- func (m *ExitField) SetEnabled(enabled bool)
- func (m *ExitField) SetHidden(hidden bool)
- func (m *ExitField) Show()
- func (m ExitField) Update(msg tea.Msg) (ExitField, tea.Cmd)
- func (m ExitField) Validate() tea.Cmd
- func (m ExitField) View() string
- type Field
- type Fields
- type File
- type FileCompletions
- type FinishedMsg
- type MultiChoiceField
- func (m *MultiChoiceField) Disable()
- func (m *MultiChoiceField) Enable()
- func (m MultiChoiceField) Enabled() bool
- func (m MultiChoiceField) Hidden() bool
- func (m *MultiChoiceField) Hide()
- func (m *MultiChoiceField) SetEnabled(enabled bool)
- func (m *MultiChoiceField) SetHidden(hidden bool)
- func (m *MultiChoiceField) Show()
- func (m MultiChoiceField) Update(msg tea.Msg) (MultiChoiceField, tea.Cmd)
- func (m MultiChoiceField) Validate() tea.Cmd
- func (m MultiChoiceField) View() string
- type MultiChoiceFieldValidator
- type Name
- type Required
- type StaticCompletions
- type SuggestionMsg
- type TextField
- func (m *TextField) Disable()
- func (m *TextField) Enable()
- func (m TextField) Enabled() bool
- func (m TextField) Hidden() bool
- func (m *TextField) Hide()
- func (m *TextField) SetEnabled(enabled bool)
- func (m *TextField) SetHidden(hidden bool)
- func (m *TextField) Show()
- func (m TextField) Update(msg tea.Msg) (TextField, tea.Cmd)
- func (m TextField) Validate() tea.Cmd
- func (m TextField) View() string
- type TextFieldValidator
- type URL
- type ValidationMsg
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ChoiceField ¶
type ChoiceField struct { choiceinput.Model Validator ChoiceFieldValidator // contains filtered or unexported fields }
func NewChoiceField ¶
func NewChoiceField() ChoiceField
func (*ChoiceField) SetEnabled ¶
func (m *ChoiceField) SetEnabled(enabled bool)
func (ChoiceField) Update ¶
func (m ChoiceField) Update(msg tea.Msg) (ChoiceField, tea.Cmd)
func (ChoiceField) Validate ¶
func (m ChoiceField) Validate() tea.Cmd
func (ChoiceField) View ¶
func (m ChoiceField) View() string
type ChoiceFieldValidator ¶
type CompletionModel ¶
type CompletionModel struct { // Returns the possible values given the current value of the model. Completions // contains filtered or unexported fields }
CompletionModel is used to add completion functionality to another model via composition. If the completion function is set, it will enable tab completion via the update model (which must be given the current value of the model).
func (CompletionModel) Update ¶
func (m CompletionModel) Update(msg tea.Msg, value string) (CompletionModel, tea.Msg)
Update the model and return the result. NOTE: we do not return a `tea.Cmd` because this is expected to run synchronously to avoid unexpected delays in the user interaction.
func (CompletionModel) View ¶
func (m CompletionModel) View() string
type Completions ¶
type ContainerImage ¶
func (*ContainerImage) ValidateTextField ¶
func (v *ContainerImage) ValidateTextField(value string) tea.Msg
type ExitField ¶
type ExitField struct { Message string // contains filtered or unexported fields }
func NewExitField ¶
func NewExitField() ExitField
func (*ExitField) SetEnabled ¶
func (m *ExitField) SetEnabled(enabled bool)
type Field ¶
type Field interface { // Enable this field. Enabled fields can receive focus for updates and will be included in views. Enable() // Enabled returns true if this field currently enabled. Enabled() bool // Disable this field. Disabled fields will not be focused, will ignore most updates and will be excluded from views. Disable() // Focus this field so it can process update messages. Only one field per form should ever be focused. Focus() // Focused returns true if this field is processing updates. Focused() bool // Blur removes focus so this field stops processing update messages. Blur() // Show ensures an enabled field will be visible in a view. Show() // Hidden returns true if this field should not appear in a view. Hidden() bool // Hide ensures that this field will not be visible in a view. Hide() // View renders this field. View() string // Validate returns a command to check the current state of the field. The command MUST produce a `ValidationMsg`. Validate() tea.Cmd }
Field represents an individual form field in a linear sequence of inputs. Initially disabled and hidden, fields should be enabled programmatically (either during initialization or in response to events related to the field); it is not necessary to show fields as they will be shown as the form progresses.
type Fields ¶
type Fields []Field
Fields is a list of fields that make up a form. When constructing a form, be sure to use pointers to the individual field structs at the time of the update. Most Bubble Tea updates operate on values, not references, so this is a little different.
type FileCompletions ¶
type FileCompletions struct { // Working directory for relative completions. WorkingDirectory string // Flag indicating "." files can be shown. AllowHidden bool // Required extensions, empty means directories only, `[]string{"*"}` is all files. Extensions []string }
func (*FileCompletions) Suggest ¶
func (c *FileCompletions) Suggest(path string) []string
Suggest returns directory contents matching the base name of the supplied path.
func (*FileCompletions) ToggleHidden ¶
func (c *FileCompletions) ToggleHidden()
ToggleHidden flips the allow hidden state.
func (*FileCompletions) View ¶
func (c *FileCompletions) View(suggestion string) string
View returns the base name of the supplied suggestion.
type FinishedMsg ¶
type FinishedMsg struct{}
FinishedMsg indicates that the last field on the form has been submitted.
type MultiChoiceField ¶
type MultiChoiceField struct { multichoiceinput.Model Validator MultiChoiceFieldValidator // contains filtered or unexported fields }
func NewMultiChoiceField ¶
func NewMultiChoiceField() MultiChoiceField
func (*MultiChoiceField) SetEnabled ¶
func (m *MultiChoiceField) SetEnabled(enabled bool)
func (MultiChoiceField) Update ¶
func (m MultiChoiceField) Update(msg tea.Msg) (MultiChoiceField, tea.Cmd)
func (MultiChoiceField) Validate ¶
func (m MultiChoiceField) Validate() tea.Cmd
func (MultiChoiceField) View ¶
func (m MultiChoiceField) View() string
type Name ¶ added in v2.0.13
func (*Name) ValidateChoiceField ¶ added in v2.0.13
type Required ¶
func (*Required) ValidateMultiChoiceField ¶
type StaticCompletions ¶
type StaticCompletions []string
StaticCompletions is just a static list of allowed final values for a field.
func (StaticCompletions) Suggest ¶
func (s StaticCompletions) Suggest(prefix string) []string
Suggest returns the values matching the supplied prefix.
func (StaticCompletions) View ¶
func (s StaticCompletions) View(suggestion string) string
View returns the suggestion unmodified.
type SuggestionMsg ¶
type SuggestionMsg string
SuggestionMsg should be used to update the value of the corresponding model.
type TextField ¶
type TextField struct { textinput.Model CompletionModel Validator TextFieldValidator // contains filtered or unexported fields }
func NewTextField ¶
func NewTextField() TextField
func (*TextField) SetEnabled ¶
func (m *TextField) SetEnabled(enabled bool)
type TextFieldValidator ¶
type ValidationMsg ¶
type ValidationMsg string
ValidationMsg is used to asynchronously validate form fields. An empty string is used to indicate a valid field while any non-empty strings indicates an error with the current field value. Validation messages are typically rendered in the view of a field and will be cleared on the first key press after the validation occurs.