Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( DefaultKeyMap = KeyMap{ Help: key.NewBinding( key.WithKeys("?"), key.WithHelp("?", "toggle help"), ), Confirm: key.NewBinding( key.WithKeys("enter"), key.WithHelp("enter", "confirm"), ), Quit: key.NewBinding( key.WithKeys("q", "esc", "ctrl+c"), key.WithHelp("q", "quit"), ), 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"), ), } HorizontalKeyMap = KeyMap{ Help: key.NewBinding( key.WithKeys("?"), key.WithHelp("?", "toggle help"), ), Confirm: key.NewBinding( key.WithKeys("enter"), key.WithHelp("enter", "confirm"), ), Quit: key.NewBinding( key.WithKeys("q", "esc", "ctrl+c"), key.WithHelp("q", "quit"), ), Prev: key.NewBinding( key.WithKeys("left", "h"), key.WithHelp("←/h", "move left"), ), Next: key.NewBinding( key.WithKeys("right", "l", "tab", " "), key.WithHelp("→/l/tab/space", "move right"), ), } )
View Source
var ThemeArrow = func(choices []string, cursor int) string { s := strings.Builder{} s.WriteString("\n") for i := 0; i < len(choices); i++ { if cursor == i { s.WriteString(constants.DefaultSelectedItemStyle.Render(fmt.Sprintf("❯ %s", choices[i]))) } else { s.WriteString(constants.DefaultItemStyle.Render(fmt.Sprintf(" %s", choices[i]))) } s.WriteString("\n") } return s.String() }
View Source
var ThemeDefault = func(choices []string, cursor int) string { s := strings.Builder{} s.WriteString("\n") for i := 0; i < len(choices); i++ { if cursor == i { s.WriteString(constants.DefaultSelectedItemStyle.Render(fmt.Sprintf("• %s", choices[i]))) } else { s.WriteString(constants.DefaultItemStyle.Render(fmt.Sprintf(" %s", choices[i]))) } s.WriteString("\n") } return s.String() }
View Source
var ThemeLine = func(choices []string, cursor int) string { s := strings.Builder{} result := make([]string, len(choices)) for index, choice := range choices { if index == cursor { result[index] = constants.DefaultSelectedItemStyle.Render(choice) } else { result[index] = constants.DefaultItemStyle.Render(choice) } } s.WriteString(strings.Join(result, " / ")) s.WriteString("\n") return s.String() }
Functions ¶
This section is empty.
Types ¶
type KeyMap ¶ added in v0.8.1
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
func (Model) DataString ¶
func (Model) TeaProgramOpts ¶ added in v0.8.4
func (m Model) TeaProgramOpts() []tea.ProgramOption
type Option ¶
type Option func(*Model)
func WithKeyMap ¶ added in v0.8.1
func WithTeaProgramOpts ¶ added in v0.8.4
func WithTeaProgramOpts(opts ...tea.ProgramOption) Option
Click to show internal directories.
Click to hide internal directories.