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 []Choice, cursor int) string { s := strings.Builder{} s.WriteString("\n") maxLen := 0 for _, choice := range choices { if maxLen < len(choice.Text) { maxLen = len(choice.Text) } } for i := 0; i < len(choices); i++ { text := choices[i].Text note := choices[i].Note if note != "" { note = strings.Repeat(" ", maxLen-len(text)+2) + constants.DefaultNoteStyle.Render(note) } choice := text + note if cursor == i { s.WriteString(constants.DefaultSelectedItemStyle.Render(("❯ " + choice))) } else { s.WriteString(constants.DefaultItemStyle.Render(fmt.Sprintf(" " + choice))) } s.WriteString("\n") } return s.String() }
View Source
var ThemeDefault = func(choices []Choice, cursor int) string { s := strings.Builder{} s.WriteString("\n") maxLen := 0 for _, choice := range choices { if maxLen < len(choice.Text) { maxLen = len(choice.Text) } } for i := 0; i < len(choices); i++ { text := choices[i].Text note := choices[i].Note if note != "" { note = strings.Repeat(" ", maxLen-len(text)+2) + constants.DefaultNoteStyle.Render(note) } choice := text + note if cursor == i { s.WriteString(constants.DefaultSelectedItemStyle.Render("• " + choice)) } else { s.WriteString(constants.DefaultItemStyle.Render(fmt.Sprintf(" " + choice))) } s.WriteString("\n") } return s.String() }
View Source
var ThemeLine = func(choices []Choice, 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.Text) } else { result[index] = constants.DefaultItemStyle.Render(choice.Text) } } 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 NewWithStrings ¶ added in v0.9.0
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.