Documentation
¶
Index ¶
- Variables
- type Form
- func (form *Form) AddInput(id, title, desc string, input textinput.Model, validators []Validator)
- func (form *Form) AddOption(id, title, desc string, options []string)
- func (form *Form) Disable(id string)
- func (form *Form) Enable(id string)
- func (form *Form) FocusedItem() FormItem
- func (form *Form) PostInit()
- func (form *Form) Update(msg tea.Msg, vault *tlockvault.Vault) tea.Cmd
- type FormItem
- type FormItemInputBox
- type FormItemOptionBox
- type FormItemWrapped
- type FormSubmittedMsg
- type Validator
Constants ¶
This section is empty.
Variables ¶
View Source
var KEY_LEFT = key.NewBinding( key.WithKeys("left"), key.WithHelp("←", "left"), )
Keybinding for moving the choosen item to right
View Source
var KEY_RIGHT = key.NewBinding( key.WithKeys("right"), key.WithHelp("→", "right"), )
Keybinding for moving the choosen item to right
Functions ¶
This section is empty.
Types ¶
type Form ¶
type Form struct { // Items Items []FormItemWrapped // Focused index FocusedIndex int // Default values Default map[string]string }
type FormItem ¶
type FormItem interface { // Handle messages Update(msg tea.Msg) tea.Cmd // View View() string // Focus Focus() // Unfocus Unfocus() // Returns the value Value() string // Sets the error message // Nil means to remove the error SetError(err *error) }
Interface that every form item must implement Form item
type FormItemInputBox ¶
type FormItemInputBox struct { // Title Title string // Description Description string // Input box Input textinput.Model // Error message ErrorMessage *error }
Form item for input boxes
type FormItemOptionBox ¶
type FormItemOptionBox struct { // Title Title string // Description Description string // Input box Values []string // Selected value SelectedIndex int // Error message Focused bool }
Form item for option box
type FormItemWrapped ¶
type FormItemWrapped struct { // ID ID string // Form item FormItem FormItem // Is it enabled Enabled bool // Validators Validators []Validator }
Form item wrapped
type FormSubmittedMsg ¶
Message that represents that the form is submitted and the items pass the validators
Click to show internal directories.
Click to hide internal directories.