multichoose

package
v0.9.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 21, 2024 License: MIT Imports: 7 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultKeyMap = KeyMap{
	Prev: key.NewBinding(
		key.WithKeys("up", "k"),
		key.WithHelp("↑/k", "move up"),
	),
	Next: key.NewBinding(
		key.WithKeys("down", "j", "tab"),
		key.WithHelp("↓/j/tab", "move down"),
	),
	Choose: key.NewBinding(
		key.WithKeys(" "),
		key.WithHelp("space", "choose"),
	),
	Confirm: key.NewBinding(
		key.WithKeys("enter"),
		key.WithHelp("enter", "confirm"),
	),
	Help: key.NewBinding(
		key.WithKeys("?"),
		key.WithHelp("?", "toggle help"),
	),
	Quit: key.NewBinding(
		key.WithKeys("q", "esc", "ctrl+c"),
		key.WithHelp("q", "quit"),
	),
}

Functions

func ThemeDefault

func ThemeDefault(choices []string, cursor int, isSelected IsSelected) string

func ThemeDot

func ThemeDot(choices []string, cursor int, isSelected IsSelected) string

Types

type IsSelected

type IsSelected func(int) bool

type KeyMap added in v0.8.1

type KeyMap struct {
	Prev    key.Binding
	Next    key.Binding
	Choose  key.Binding
	Confirm key.Binding
	Help    key.Binding
	Quit    key.Binding
}

func (KeyMap) FullHelp added in v0.8.1

func (k KeyMap) FullHelp() [][]key.Binding

func (KeyMap) ShortHelp added in v0.8.1

func (k KeyMap) ShortHelp() []key.Binding

type Model

type Model struct {
	// contains filtered or unexported fields
}

func New

func New(choices []string, opts ...Option) *Model

func (Model) Data

func (m Model) Data() []string

func (Model) DataString

func (m Model) DataString() string

func (Model) Error added in v0.8.0

func (m Model) Error() error

func (Model) Init

func (m Model) Init() tea.Cmd

func (Model) Quitting added in v0.8.0

func (m Model) Quitting() bool

func (Model) TeaProgramOpts added in v0.8.4

func (m Model) TeaProgramOpts() []tea.ProgramOption

func (Model) Update

func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (Model) View

func (m Model) View() string

type Option

type Option func(*Model)

func WithDefaultIndexes added in v0.9.2

func WithDefaultIndexes(cursor int, indexes []int) Option

func WithHelp added in v0.8.0

func WithHelp(show bool) Option

func WithKeyMap added in v0.8.1

func WithKeyMap(keyMap KeyMap) Option

func WithLimit added in v0.8.4

func WithLimit(limit int) Option

func WithTeaProgramOpts added in v0.8.4

func WithTeaProgramOpts(opts ...tea.ProgramOption) Option

func WithTheme

func WithTheme(theme Theme) Option

type Theme

type Theme func([]string, int, IsSelected) string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL