Documentation
¶
Index ¶
- func Pick(label string, horizontal bool, idx int, items ...string) (int, error)
- func Showcase()
- type Model
- func (m *Model) Canceled() bool
- func (m *Model) Init() tea.Cmd
- func (m *Model) Quit() bool
- func (m *Model) SelectedIdx() int
- func (m *Model) SelectedItem() string
- func (m *Model) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (m *Model) View() string
- func (m *Model) WithCancel(cancelable bool) *Model
- func (m *Model) WithHorizontal(horizontal bool) *Model
- func (m *Model) WithLabel(label string) *Model
- func (m *Model) WithLabelColor(color lipgloss.Color) *Model
- func (m *Model) WithLabelStyle(style lipgloss.Style) *Model
- func (m *Model) WithNormalFormat(format string) *Model
- func (m *Model) WithNormalItemColor(color lipgloss.Color) *Model
- func (m *Model) WithNormalItemStyle(style lipgloss.Style) *Model
- func (m *Model) WithQuit(quitable bool) *Model
- func (m *Model) WithSelectedFormat(format string) *Model
- func (m *Model) WithSelectedIndex(i int) *Model
- func (m *Model) WithSelectedItemColor(color lipgloss.Color) *Model
- func (m *Model) WithSelectedItemStyle(style lipgloss.Style) *Model
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
Model represents a selectable list component.
func (*Model) SelectedIdx ¶
SelectedIdx returns the index of the selected item.
func (*Model) SelectedItem ¶
SelectedItem returns the selected item, or an empty string if no selection was performed.
func (*Model) Update ¶
Update handles user input and updates the list state by processing key messages and updating the selected index accordingly.
func (*Model) View ¶
View renders the list as a string, displaying the label and items with their respective styles.
func (*Model) WithCancel ¶
WithCancel sets the cancelable flag and returns a new Model with the updated flag.
func (*Model) WithHorizontal ¶
WithHorizontal sets whether the items should be displayed horizontally and returns a new Model with the updated horizontal setting.
func (*Model) WithLabel ¶
WithLabel sets the label of the Model and returns a new Model with the updated label.
func (*Model) WithLabelColor ¶
WithLabelColor sets the color of the label and returns a new Model with the updated label color.
func (*Model) WithLabelStyle ¶
WithLabelStyle sets the style of the label and returns a new Model with the updated label style.
func (*Model) WithNormalFormat ¶
WithNormalFormat sets the format string for normal (unselected) items and returns a new Model with the updated normal format.
func (*Model) WithNormalItemColor ¶
WithNormalItemColor sets the color of the normal (unselected) items and returns a new Model with the updated normal item color.
func (*Model) WithNormalItemStyle ¶
WithNormalItemStyle sets the style of the normal (unselected) items and returns a new Model with the updated normal item style.
func (*Model) WithQuit ¶
WithQuit sets the quitable flag and returns a new Model with the updated flag.
func (*Model) WithSelectedFormat ¶
WithSelectedFormat sets the format string for the selected item and returns a new Model with the updated selected format.
func (*Model) WithSelectedIndex ¶
WithSelectedIndex sets the index of the initially selected item and returns a new Model with the updated selected index.
func (*Model) WithSelectedItemColor ¶
WithSelectedItemColor sets the color of the selected item and returns a new Model with the updated selected item color.