Documentation ¶
Index ¶
- Variables
- func Run(field Field) error
- type Confirm
- func (c *Confirm) Affirmative(affirmative string) *Confirm
- func (c *Confirm) Blur() tea.Cmd
- func (c *Confirm) Description(description string) *Confirm
- func (c *Confirm) Error() error
- func (c *Confirm) Focus() tea.Cmd
- func (c *Confirm) GetKey() string
- func (c *Confirm) GetValue() any
- func (c *Confirm) Init() tea.Cmd
- func (c *Confirm) Inline(inline bool) *Confirm
- func (c *Confirm) Key(key string) *Confirm
- func (c *Confirm) KeyBinds() []key.Binding
- func (c *Confirm) Negative(negative string) *Confirm
- func (c *Confirm) Run() error
- func (*Confirm) Skip() bool
- func (c *Confirm) String() string
- func (c *Confirm) Title(title string) *Confirm
- func (c *Confirm) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (c *Confirm) Validate(validate func(bool) error) *Confirm
- func (c *Confirm) Value(value *bool) *Confirm
- func (c *Confirm) View() string
- func (c *Confirm) WithAccessible(accessible bool) Field
- func (c *Confirm) WithHeight(height int) Field
- func (c *Confirm) WithKeyMap(k *KeyMap) Field
- func (c *Confirm) WithPosition(p FieldPosition) Field
- func (c *Confirm) WithTheme(theme *Theme) Field
- func (c *Confirm) WithWidth(width int) Field
- func (*Confirm) Zoom() bool
- type ConfirmKeyMap
- type EchoMode
- type Field
- type FieldPosition
- type FieldStyles
- type FilePicker
- func (f *FilePicker) AllowedTypes(types []string) *FilePicker
- func (f *FilePicker) Blur() tea.Cmd
- func (f *FilePicker) CurrentDirectory(directory string) *FilePicker
- func (f *FilePicker) Description(description string) *FilePicker
- func (f *FilePicker) Error() error
- func (f *FilePicker) Focus() tea.Cmd
- func (f *FilePicker) GetKey() string
- func (f *FilePicker) GetValue() any
- func (f *FilePicker) Height(height int) *FilePicker
- func (f *FilePicker) Init() tea.Cmd
- func (f *FilePicker) Key(key string) *FilePicker
- func (f *FilePicker) KeyBinds() []key.Binding
- func (f *FilePicker) Run() error
- func (f *FilePicker) ShowHidden(v bool) *FilePicker
- func (*FilePicker) Skip() bool
- func (f *FilePicker) Title(title string) *FilePicker
- func (f *FilePicker) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (f *FilePicker) Validate(validate func(string) error) *FilePicker
- func (f *FilePicker) Value(value *string) *FilePicker
- func (f *FilePicker) View() string
- func (f *FilePicker) WithAccessible(accessible bool) Field
- func (f *FilePicker) WithHeight(height int) Field
- func (f *FilePicker) WithKeyMap(k *KeyMap) Field
- func (f *FilePicker) WithPosition(p FieldPosition) Field
- func (f *FilePicker) WithTheme(theme *Theme) Field
- func (f *FilePicker) WithWidth(width int) Field
- func (f *FilePicker) Zoom() bool
- type FilePickerKeyMap
- type Form
- func (f *Form) Errors() []error
- func (f *Form) Get(key string) any
- func (f *Form) GetBool(key string) bool
- func (f *Form) GetInt(key string) int
- func (f *Form) GetString(key string) string
- func (f *Form) Help() help.Model
- func (f *Form) Init() tea.Cmd
- func (f *Form) KeyBinds() []key.Binding
- func (f *Form) NextField() tea.Cmd
- func (f *Form) NextGroup() tea.Cmd
- func (f *Form) PrevField() tea.Cmd
- func (f *Form) PrevGroup() tea.Cmd
- func (f *Form) Run() error
- func (f *Form) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (f *Form) UpdateFieldPositions() *Form
- func (f *Form) View() string
- func (f *Form) WithAccessible(accessible bool) *Form
- func (f *Form) WithHeight(height int) *Form
- func (f *Form) WithKeyMap(keymap *KeyMap) *Form
- func (f *Form) WithShowErrors(v bool) *Form
- func (f *Form) WithShowHelp(v bool) *Form
- func (f *Form) WithTheme(theme *Theme) *Form
- func (f *Form) WithWidth(width int) *Form
- type FormState
- type Group
- func (g *Group) Description(description string) *Group
- func (g *Group) Errors() []error
- func (g *Group) Init() tea.Cmd
- func (g *Group) Title(title string) *Group
- func (g *Group) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (g *Group) View() string
- func (g *Group) WithHeight(height int) *Group
- func (g *Group) WithHide(hide bool) *Group
- func (g *Group) WithHideFunc(hideFunc func() bool) *Group
- func (g *Group) WithKeyMap(k *KeyMap) *Group
- func (g *Group) WithShowErrors(show bool) *Group
- func (g *Group) WithShowHelp(show bool) *Group
- func (g *Group) WithTheme(t *Theme) *Group
- func (g *Group) WithWidth(width int) *Group
- type Input
- func (i *Input) Blur() tea.Cmd
- func (i *Input) CharLimit(charlimit int) *Input
- func (i *Input) Description(description string) *Input
- func (i *Input) EchoMode(mode EchoMode) *Input
- func (i *Input) Error() error
- func (i *Input) Focus() tea.Cmd
- func (i *Input) GetKey() string
- func (i *Input) GetValue() any
- func (i *Input) Init() tea.Cmd
- func (i *Input) Inline(inline bool) *Input
- func (i *Input) Key(key string) *Input
- func (i *Input) KeyBinds() []key.Binding
- func (i *Input) Password(password bool) *Inputdeprecated
- func (i *Input) Placeholder(str string) *Input
- func (i *Input) Prompt(prompt string) *Input
- func (i *Input) Run() error
- func (*Input) Skip() bool
- func (i *Input) Suggestions(suggestions []string) *Input
- func (i *Input) Title(title string) *Input
- func (i *Input) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (i *Input) Validate(validate func(string) error) *Input
- func (i *Input) Value(value *string) *Input
- func (i *Input) View() string
- func (i *Input) WithAccessible(accessible bool) Field
- func (i *Input) WithHeight(height int) Field
- func (i *Input) WithKeyMap(k *KeyMap) Field
- func (i *Input) WithPosition(p FieldPosition) Field
- func (i *Input) WithTheme(theme *Theme) Field
- func (i *Input) WithWidth(width int) Field
- func (*Input) Zoom() bool
- type InputKeyMap
- type KeyMap
- type MultiSelect
- func (m *MultiSelect[T]) Blur() tea.Cmd
- func (m *MultiSelect[T]) Description(description string) *MultiSelect[T]
- func (m *MultiSelect[T]) Error() error
- func (m *MultiSelect[T]) Filterable(filterable bool) *MultiSelect[T]
- func (m *MultiSelect[T]) Focus() tea.Cmd
- func (m *MultiSelect[T]) GetKey() string
- func (m *MultiSelect[T]) GetValue() any
- func (m *MultiSelect[T]) Height(height int) *MultiSelect[T]
- func (m *MultiSelect[T]) Init() tea.Cmd
- func (m *MultiSelect[T]) Key(key string) *MultiSelect[T]
- func (m *MultiSelect[T]) KeyBinds() []key.Binding
- func (m *MultiSelect[T]) Limit(limit int) *MultiSelect[T]
- func (m *MultiSelect[T]) Options(options ...Option[T]) *MultiSelect[T]
- func (m *MultiSelect[T]) Run() error
- func (*MultiSelect[T]) Skip() bool
- func (m *MultiSelect[T]) Title(title string) *MultiSelect[T]
- func (m *MultiSelect[T]) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (m *MultiSelect[T]) Validate(validate func([]T) error) *MultiSelect[T]
- func (m *MultiSelect[T]) Value(value *[]T) *MultiSelect[T]
- func (m *MultiSelect[T]) View() string
- func (m *MultiSelect[T]) WithAccessible(accessible bool) Field
- func (m *MultiSelect[T]) WithHeight(height int) Field
- func (m *MultiSelect[T]) WithKeyMap(k *KeyMap) Field
- func (m *MultiSelect[T]) WithPosition(p FieldPosition) Field
- func (m *MultiSelect[T]) WithTheme(theme *Theme) Field
- func (m *MultiSelect[T]) WithWidth(width int) Field
- func (*MultiSelect[T]) Zoom() bool
- type MultiSelectKeyMap
- type Note
- func (n *Note) Blur() tea.Cmd
- func (n *Note) Description(description string) *Note
- func (n *Note) Error() error
- func (n *Note) Focus() tea.Cmd
- func (n *Note) GetKey() string
- func (n *Note) GetValue() any
- func (n *Note) Init() tea.Cmd
- func (n *Note) KeyBinds() []key.Binding
- func (n *Note) Next(show bool) *Note
- func (n *Note) Run() error
- func (n *Note) Skip() bool
- func (n *Note) Title(title string) *Note
- func (n *Note) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (n *Note) View() string
- func (n *Note) WithAccessible(accessible bool) Field
- func (n *Note) WithHeight(height int) Field
- func (n *Note) WithKeyMap(k *KeyMap) Field
- func (n *Note) WithPosition(p FieldPosition) Field
- func (n *Note) WithTheme(theme *Theme) Field
- func (n *Note) WithWidth(width int) Field
- func (n *Note) Zoom() bool
- type NoteKeyMap
- type Option
- type Select
- func (s *Select[T]) Blur() tea.Cmd
- func (s *Select[T]) Description(description string) *Select[T]
- func (s *Select[T]) Error() error
- func (s *Select[T]) Focus() tea.Cmd
- func (s *Select[T]) GetKey() string
- func (s *Select[T]) GetValue() any
- func (s *Select[T]) Height(height int) *Select[T]
- func (s *Select[T]) Init() tea.Cmd
- func (s *Select[T]) Inline(v bool) *Select[T]
- func (s *Select[T]) Key(key string) *Select[T]
- func (s *Select[T]) KeyBinds() []key.Binding
- func (s *Select[T]) Options(options ...Option[T]) *Select[T]
- func (s *Select[T]) Run() error
- func (*Select[T]) Skip() bool
- func (s *Select[T]) Title(title string) *Select[T]
- func (s *Select[T]) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (s *Select[T]) Validate(validate func(T) error) *Select[T]
- func (s *Select[T]) Value(value *T) *Select[T]
- func (s *Select[T]) View() string
- func (s *Select[T]) WithAccessible(accessible bool) Field
- func (s *Select[T]) WithHeight(height int) Field
- func (s *Select[T]) WithKeyMap(k *KeyMap) Field
- func (s *Select[T]) WithPosition(p FieldPosition) Field
- func (s *Select[T]) WithTheme(theme *Theme) Field
- func (s *Select[T]) WithWidth(width int) Field
- func (*Select[T]) Zoom() bool
- type SelectKeyMap
- type Text
- func (t *Text) Blur() tea.Cmd
- func (t *Text) CharLimit(charlimit int) *Text
- func (t *Text) Description(description string) *Text
- func (t *Text) Editor(editor ...string) *Text
- func (t *Text) EditorExtension(extension string) *Text
- func (t *Text) Error() error
- func (t *Text) Focus() tea.Cmd
- func (t *Text) GetKey() string
- func (t *Text) GetValue() any
- func (t *Text) Init() tea.Cmd
- func (t *Text) Key(key string) *Text
- func (t *Text) KeyBinds() []key.Binding
- func (t *Text) Lines(lines int) *Text
- func (t *Text) Placeholder(str string) *Text
- func (t *Text) Run() error
- func (t *Text) ShowLineNumbers(show bool) *Text
- func (*Text) Skip() bool
- func (t *Text) Title(title string) *Text
- func (t *Text) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (t *Text) Validate(validate func(string) error) *Text
- func (t *Text) Value(value *string) *Text
- func (t *Text) View() string
- func (t *Text) WithAccessible(accessible bool) Field
- func (t *Text) WithHeight(height int) Field
- func (t *Text) WithKeyMap(k *KeyMap) Field
- func (t *Text) WithPosition(p FieldPosition) Field
- func (t *Text) WithTheme(theme *Theme) Field
- func (t *Text) WithWidth(width int) Field
- func (*Text) Zoom() bool
- type TextInputStyles
- type TextKeyMap
- type Theme
Constants ¶
This section is empty.
Variables ¶
var ErrUserAborted = errors.New("user aborted")
ErrUserAborted is the error returned when a user exits the form before submitting.
Functions ¶
Types ¶
type Confirm ¶
type Confirm struct {
// contains filtered or unexported fields
}
Confirm is a form confirm field.
func (*Confirm) Affirmative ¶
Affirmative sets the affirmative value of the confirm field.
func (*Confirm) Description ¶
Description sets the description of the confirm field.
func (*Confirm) WithAccessible ¶
WithAccessible sets the accessible mode of the confirm field.
func (*Confirm) WithHeight ¶
WithHeight sets the height of the confirm field.
func (*Confirm) WithKeyMap ¶
WithKeyMap sets the keymap of the confirm field.
func (*Confirm) WithPosition ¶
func (c *Confirm) WithPosition(p FieldPosition) Field
WithPosition sets the position of the confirm field.
type ConfirmKeyMap ¶
type ConfirmKeyMap struct { Next key.Binding Prev key.Binding Toggle key.Binding Submit key.Binding }
ConfirmKeyMap is the keybindings for confirm fields.
type EchoMode ¶
EchoMode sets the input behavior of the text Input field.
const ( // EchoNormal displays text as is. // This is the default behavior. EchoModeNormal EchoMode = EchoMode(textinput.EchoNormal) // EchoPassword displays the EchoCharacter mask instead of actual characters. // This is commonly used for password fields. EchoModePassword EchoMode = EchoMode(textinput.EchoPassword) // EchoNone displays nothing as characters are entered. // This is commonly seen for password fields on the command line. EchoModeNone EchoMode = EchoMode(textinput.EchoNone) )
type Field ¶
type Field interface { // Bubble Tea Model Init() tea.Cmd Update(tea.Msg) (tea.Model, tea.Cmd) View() string // Bubble Tea Events Blur() tea.Cmd Focus() tea.Cmd // Errors and Validation Error() error // Run runs the field individually. Run() error // Skip returns whether this input should be skipped or not. Skip() bool // Zoom returns whether this input should be zoomed or not. // Zoom allows the field to take focus of the group / form height. Zoom() bool // KeyBinds returns help keybindings. KeyBinds() []key.Binding // WithTheme sets the theme on a field. WithTheme(*Theme) Field // WithAccessible sets whether the field should run in accessible mode. WithAccessible(bool) Field // WithKeyMap sets the keymap on a field. WithKeyMap(*KeyMap) Field // WithWidth sets the width of a field. WithWidth(int) Field // WithHeight sets the height of a field. WithHeight(int) Field // WithPosition tells the field the index of the group and position it is in. WithPosition(FieldPosition) Field // GetKey returns the field's key. GetKey() string // GetValue returns the field's value. GetValue() any }
Field is a primitive of a form.
A field represents a single input control on a form such as a text input, confirm button, select option, etc...
Each field implements the Bubble Tea Model interface.
type FieldPosition ¶
type FieldPosition struct { Group int Field int FirstField int LastField int GroupCount int FirstGroup int LastGroup int }
FieldPosition is positional information about the given field and form.
func (FieldPosition) IsFirst ¶
func (p FieldPosition) IsFirst() bool
IsFirst returns whether a field is the form's first field.
func (FieldPosition) IsLast ¶
func (p FieldPosition) IsLast() bool
IsLast returns whether a field is the form's last field.
type FieldStyles ¶
type FieldStyles struct { Base lipgloss.Style Title lipgloss.Style Description lipgloss.Style ErrorIndicator lipgloss.Style ErrorMessage lipgloss.Style // Select styles. SelectSelector lipgloss.Style // Selection indicator Option lipgloss.Style // Select options NextIndicator lipgloss.Style PrevIndicator lipgloss.Style // FilePicker styles. Directory lipgloss.Style File lipgloss.Style // Multi-select styles. MultiSelectSelector lipgloss.Style SelectedOption lipgloss.Style SelectedPrefix lipgloss.Style UnselectedOption lipgloss.Style UnselectedPrefix lipgloss.Style // Textinput and teatarea styles. TextInput TextInputStyles // Confirm styles. FocusedButton lipgloss.Style BlurredButton lipgloss.Style // Card styles. Card lipgloss.Style NoteTitle lipgloss.Style Next lipgloss.Style }
FieldStyles are the styles for input fields.
type FilePicker ¶
type FilePicker struct {
// contains filtered or unexported fields
}
FilePicker is a form file file field.
func (*FilePicker) AllowedTypes ¶
func (f *FilePicker) AllowedTypes(types []string) *FilePicker
AllowedTypes sets the allowed types of the file field. These will be the only valid file types accepted, other files will show as disabled.
func (*FilePicker) CurrentDirectory ¶
func (f *FilePicker) CurrentDirectory(directory string) *FilePicker
CurrentDirectory sets the directory of the file field.
func (*FilePicker) Description ¶
func (f *FilePicker) Description(description string) *FilePicker
Description sets the description of the file field.
func (*FilePicker) Error ¶
func (f *FilePicker) Error() error
Error returns the error of the file field.
func (*FilePicker) GetKey ¶
func (f *FilePicker) GetKey() string
GetKey returns the key of the field.
func (*FilePicker) GetValue ¶
func (f *FilePicker) GetValue() any
GetValue returns the value of the field.
func (*FilePicker) Height ¶
func (f *FilePicker) Height(height int) *FilePicker
Height sets the height of the file field. If the number of options exceeds the height, the file field will become scrollable.
func (*FilePicker) Key ¶
func (f *FilePicker) Key(key string) *FilePicker
Key sets the key of the file field which can be used to retrieve the value after submission.
func (*FilePicker) KeyBinds ¶
func (f *FilePicker) KeyBinds() []key.Binding
KeyBinds returns the help keybindings for the file field.
func (*FilePicker) ShowHidden ¶
func (f *FilePicker) ShowHidden(v bool) *FilePicker
ShowHidden sets whether to show hidden files.
func (*FilePicker) Skip ¶
func (*FilePicker) Skip() bool
Skip returns whether the file should be skipped or should be blocking.
func (*FilePicker) Title ¶
func (f *FilePicker) Title(title string) *FilePicker
Title sets the title of the file field.
func (*FilePicker) Validate ¶
func (f *FilePicker) Validate(validate func(string) error) *FilePicker
Validate sets the validation function of the file field.
func (*FilePicker) Value ¶
func (f *FilePicker) Value(value *string) *FilePicker
Value sets the value of the file field.
func (*FilePicker) WithAccessible ¶
func (f *FilePicker) WithAccessible(accessible bool) Field
WithAccessible sets the accessible mode of the file field.
func (*FilePicker) WithHeight ¶
func (f *FilePicker) WithHeight(height int) Field
WithHeight sets the height of the file field.
func (*FilePicker) WithKeyMap ¶
func (f *FilePicker) WithKeyMap(k *KeyMap) Field
WithKeyMap sets the keymap on a file field.
func (*FilePicker) WithPosition ¶
func (f *FilePicker) WithPosition(p FieldPosition) Field
WithPosition sets the position of the file field.
func (*FilePicker) WithTheme ¶
func (f *FilePicker) WithTheme(theme *Theme) Field
WithTheme sets the theme of the file field.
func (*FilePicker) WithWidth ¶
func (f *FilePicker) WithWidth(width int) Field
WithWidth sets the width of the file field.
func (*FilePicker) Zoom ¶
func (f *FilePicker) Zoom() bool
Zoom returns whether the input should be zoomed.
type FilePickerKeyMap ¶
type FilePickerKeyMap struct { Open key.Binding Close key.Binding GoToTop key.Binding GoToLast key.Binding PageUp key.Binding PageDown key.Binding Back key.Binding Select key.Binding Up key.Binding Down key.Binding Prev key.Binding Next key.Binding Submit key.Binding }
FilePickerKey is the keybindings for filepicker fields.
type Form ¶
type Form struct { State FormState // contains filtered or unexported fields }
Form is a collection of groups that are displayed one at a time on a "page".
The form can navigate between groups and is complete once all the groups are complete.
func NewForm ¶
NewForm returns a form with the given groups and default themes and keybindings.
Use With* methods to customize the form with options, such as setting different themes and keybindings.
func (*Form) UpdateFieldPositions ¶
UpdateFieldPositions sets the position on all the fields.
func (*Form) WithAccessible ¶
WithAccessible sets the form to run in accessible mode to avoid redrawing the views which makes it easier for screen readers to read and describe the form.
This avoids using the Bubble Tea renderer and instead simply uses basic terminal prompting to gather input which degrades the user experience but provides accessibility.
func (*Form) WithHeight ¶
WithHeight sets the height of a form.
func (*Form) WithKeyMap ¶
WithKeyMap sets the keymap on a form.
This allows customization of the form key bindings.
func (*Form) WithShowErrors ¶
WithShowErrors sets whether or not the form should show errors.
This allows the form groups and fields to show errors when the Validate function returns an error.
func (*Form) WithShowHelp ¶
WithShowHelp sets whether or not the form should show help.
This allows the form groups and field to show what keybindings are available to the user.
type Group ¶
type Group struct {
// contains filtered or unexported fields
}
Group is a collection of fields that are displayed together with a page of the form. While a group is displayed the form completer can switch between fields in the group.
If any of the fields in a group have errors, the form will not be able to progress to the next group.
func (*Group) Description ¶
Description sets the group's description.
func (*Group) WithHeight ¶
WithHeight sets the height on a group.
func (*Group) WithHideFunc ¶
WithHideFunc sets the function that checks if this group should be skipped.
func (*Group) WithKeyMap ¶
WithKeyMap sets the keymap on a group.
func (*Group) WithShowErrors ¶
WithShowErrors sets whether or not the group's errors should be shown.
func (*Group) WithShowHelp ¶
WithShowHelp sets whether or not the group's help should be shown.
type Input ¶
type Input struct {
// contains filtered or unexported fields
}
Input is a form input field.
func (*Input) Description ¶
Description sets the description of the input field.
func (*Input) Placeholder ¶
Placeholder sets the placeholder of the text input.
func (*Input) Suggestions ¶
Suggestions sets the suggestions to display for autocomplete in the input field.
func (*Input) WithAccessible ¶
WithAccessible sets the accessible mode of the input field.
func (*Input) WithHeight ¶
WithHeight sets the height of the input field.
func (*Input) WithKeyMap ¶
WithKeyMap sets the keymap on an input field.
func (*Input) WithPosition ¶
func (i *Input) WithPosition(p FieldPosition) Field
WithPosition sets the position of the input field.
type InputKeyMap ¶
type InputKeyMap struct { AcceptSuggestion key.Binding Next key.Binding Prev key.Binding Submit key.Binding }
InputKeyMap is the keybindings for input fields.
type KeyMap ¶
type KeyMap struct { Quit key.Binding Confirm ConfirmKeyMap FilePicker FilePickerKeyMap Input InputKeyMap MultiSelect MultiSelectKeyMap Note NoteKeyMap Select SelectKeyMap Text TextKeyMap }
KeyMap is the keybindings to navigate the form.
func NewDefaultKeyMap ¶
func NewDefaultKeyMap() *KeyMap
NewDefaultKeyMap returns a new default keymap.
type MultiSelect ¶
type MultiSelect[T comparable] struct { // contains filtered or unexported fields }
MultiSelect is a form multi-select field.
func NewMultiSelect ¶
func NewMultiSelect[T comparable]() *MultiSelect[T]
NewMultiSelect returns a new multi-select field.
func (*MultiSelect[T]) Blur ¶
func (m *MultiSelect[T]) Blur() tea.Cmd
Blur blurs the multi-select field.
func (*MultiSelect[T]) Description ¶
func (m *MultiSelect[T]) Description(description string) *MultiSelect[T]
Description sets the description of the multi-select field.
func (*MultiSelect[T]) Error ¶
func (m *MultiSelect[T]) Error() error
Error returns the error of the multi-select field.
func (*MultiSelect[T]) Filterable ¶
func (m *MultiSelect[T]) Filterable(filterable bool) *MultiSelect[T]
Filterable sets the multi-select field as filterable.
func (*MultiSelect[T]) Focus ¶
func (m *MultiSelect[T]) Focus() tea.Cmd
Focus focuses the multi-select field.
func (*MultiSelect[T]) GetKey ¶
func (m *MultiSelect[T]) GetKey() string
GetKey returns the multi-select's key.
func (*MultiSelect[T]) GetValue ¶
func (m *MultiSelect[T]) GetValue() any
GetValue returns the multi-select's value.
func (*MultiSelect[T]) Height ¶
func (m *MultiSelect[T]) Height(height int) *MultiSelect[T]
Height sets the height of the multi-select field.
func (*MultiSelect[T]) Init ¶
func (m *MultiSelect[T]) Init() tea.Cmd
Init initializes the multi-select field.
func (*MultiSelect[T]) Key ¶
func (m *MultiSelect[T]) Key(key string) *MultiSelect[T]
Key sets the key of the select field which can be used to retrieve the value after submission.
func (*MultiSelect[T]) KeyBinds ¶
func (m *MultiSelect[T]) KeyBinds() []key.Binding
KeyBinds returns the help message for the multi-select field.
func (*MultiSelect[T]) Limit ¶
func (m *MultiSelect[T]) Limit(limit int) *MultiSelect[T]
Limit sets the limit of the multi-select field.
func (*MultiSelect[T]) Options ¶
func (m *MultiSelect[T]) Options(options ...Option[T]) *MultiSelect[T]
Options sets the options of the multi-select field.
func (*MultiSelect[T]) Skip ¶
func (*MultiSelect[T]) Skip() bool
Skip returns whether the multiselect should be skipped or should be blocking.
func (*MultiSelect[T]) Title ¶
func (m *MultiSelect[T]) Title(title string) *MultiSelect[T]
Title sets the title of the multi-select field.
func (*MultiSelect[T]) Validate ¶
func (m *MultiSelect[T]) Validate(validate func([]T) error) *MultiSelect[T]
Validate sets the validation function of the multi-select field.
func (*MultiSelect[T]) Value ¶
func (m *MultiSelect[T]) Value(value *[]T) *MultiSelect[T]
Value sets the value of the multi-select field.
func (*MultiSelect[T]) View ¶
func (m *MultiSelect[T]) View() string
View renders the multi-select field.
func (*MultiSelect[T]) WithAccessible ¶
func (m *MultiSelect[T]) WithAccessible(accessible bool) Field
WithAccessible sets the accessible mode of the multi-select field.
func (*MultiSelect[T]) WithHeight ¶
func (m *MultiSelect[T]) WithHeight(height int) Field
WithHeight sets the height of the multi-select field.
func (*MultiSelect[T]) WithKeyMap ¶
func (m *MultiSelect[T]) WithKeyMap(k *KeyMap) Field
WithKeyMap sets the keymap of the multi-select field.
func (*MultiSelect[T]) WithPosition ¶
func (m *MultiSelect[T]) WithPosition(p FieldPosition) Field
WithPosition sets the position of the multi-select field.
func (*MultiSelect[T]) WithTheme ¶
func (m *MultiSelect[T]) WithTheme(theme *Theme) Field
WithTheme sets the theme of the multi-select field.
func (*MultiSelect[T]) WithWidth ¶
func (m *MultiSelect[T]) WithWidth(width int) Field
WithWidth sets the width of the multi-select field.
func (*MultiSelect[T]) Zoom ¶
func (*MultiSelect[T]) Zoom() bool
Zoom returns whether the multiselect should be zoomed.
type MultiSelectKeyMap ¶
type MultiSelectKeyMap struct { Next key.Binding Prev key.Binding Up key.Binding Down key.Binding HalfPageUp key.Binding HalfPageDown key.Binding GotoTop key.Binding GotoBottom key.Binding Toggle key.Binding Filter key.Binding SetFilter key.Binding ClearFilter key.Binding Submit key.Binding }
MultiSelectKeyMap is the keybindings for multi-select fields.
type Note ¶
type Note struct {
// contains filtered or unexported fields
}
Note is a form note field.
func (*Note) Description ¶
Description sets the description of the note field.
func (*Note) WithAccessible ¶
WithAccessible sets the accessible mode of the note field.
func (*Note) WithHeight ¶
WithHeight sets the height of the note field.
func (*Note) WithKeyMap ¶
WithKeyMap sets the keymap on a note field.
func (*Note) WithPosition ¶
func (n *Note) WithPosition(p FieldPosition) Field
WithPosition sets the position information of the note field.
type NoteKeyMap ¶
NoteKeyMap is the keybindings for note fields.
type Option ¶
type Option[T comparable] struct { Key string Value T // contains filtered or unexported fields }
Option is an option for select fields.
func NewOption ¶
func NewOption[T comparable](key string, value T) Option[T]
NewOption returns a new select option.
func NewOptions ¶
func NewOptions[T comparable](values ...T) []Option[T]
NewOptions returns new options from a list of values.
type Select ¶
type Select[T comparable] struct { // contains filtered or unexported fields }
Select is a form select field.
func (*Select[T]) Description ¶
Description sets the description of the select field.
func (*Select[T]) Height ¶
Height sets the height of the select field. If the number of options exceeds the height, the select field will become scrollable.
func (*Select[T]) Key ¶
Key sets the key of the select field which can be used to retrieve the value after submission.
func (*Select[T]) WithAccessible ¶
WithAccessible sets the accessible mode of the select field.
func (*Select[T]) WithHeight ¶
WithHeight sets the height of the select field.
func (*Select[T]) WithKeyMap ¶
WithKeyMap sets the keymap on a select field.
func (*Select[T]) WithPosition ¶
func (s *Select[T]) WithPosition(p FieldPosition) Field
WithPosition sets the position of the select field.
type SelectKeyMap ¶
type SelectKeyMap struct { Next key.Binding Prev key.Binding Up key.Binding Down key.Binding HalfPageUp key.Binding HalfPageDown key.Binding GotoTop key.Binding GotoBottom key.Binding Left key.Binding Right key.Binding Filter key.Binding SetFilter key.Binding ClearFilter key.Binding Submit key.Binding }
SelectKeyMap is the keybindings for select fields.
type Text ¶
type Text struct {
// contains filtered or unexported fields
}
Text is a form text field. It allows for a multi-line string input.
func (*Text) Description ¶
Description sets the description of the text field.
func (*Text) Editor ¶
Editor specifies which editor to use.
The first argument provided is used as the editor command (vim, nvim, nano, etc...) The following (optional) arguments provided are passed as arguments to the editor command.
func (*Text) EditorExtension ¶
EditorExtension specifies arguments to pass into the editor.
func (*Text) Placeholder ¶
Placeholder sets the placeholder of the text field.
func (*Text) ShowLineNumbers ¶
ShowLineNumbers sets whether or not to show line numbers.
func (*Text) WithAccessible ¶
WithAccessible sets the accessible mode of the text field.
func (*Text) WithHeight ¶
WithHeight sets the height of the text field.
func (*Text) WithKeyMap ¶
WithKeyMap sets the keymap on a text field.
func (*Text) WithPosition ¶
func (t *Text) WithPosition(p FieldPosition) Field
WithPosition sets the position information of the text field.
type TextInputStyles ¶
type TextInputStyles struct { Cursor lipgloss.Style Placeholder lipgloss.Style Prompt lipgloss.Style Text lipgloss.Style }
TextInputStyles are the styles for text inputs.
type TextKeyMap ¶
type TextKeyMap struct { Next key.Binding Prev key.Binding NewLine key.Binding Editor key.Binding Submit key.Binding }
TextKeyMap is the keybindings for text fields.
type Theme ¶
type Theme struct { Form lipgloss.Style Group lipgloss.Style FieldSeparator lipgloss.Style Blurred FieldStyles Focused FieldStyles Help help.Styles }
Theme is a collection of styles for components of the form. Themes can be applied to a form using the WithTheme option.
func ThemeBase ¶
func ThemeBase() *Theme
ThemeBase returns a new base theme with general styles to be inherited by other themes.
func ThemeBase16 ¶
func ThemeBase16() *Theme
ThemeBase16 returns a new theme based on the base16 color scheme.
func ThemeCatppuccin ¶
func ThemeCatppuccin() *Theme
ThemeCatppuccin returns a new theme based on the Catppuccin color scheme.
func ThemeCharm ¶
func ThemeCharm() *Theme
ThemeCharm returns a new theme based on the Charm color scheme.
func ThemeDracula ¶
func ThemeDracula() *Theme
ThemeDracula returns a new theme based on the Dracula color scheme.