Documentation
¶
Overview ¶
Package scrollinglist provides a scrollalbe list bubbletea component
Index ¶
- Variables
- func InitStyles()
- func PrefixSumBreak(list []int, valueToReach int) (int, int)
- func SuffixSumBreak(list []int, valueToReach int) (int, int)
- type KeyMap
- type ScrollingList
- func (sl *ScrollingList) FooterView() string
- func (sl *ScrollingList) GetCurrentVisibleRange() (int, int)
- func (sl *ScrollingList) GetFocused() int
- func (sl *ScrollingList) GotoBottom()
- func (sl *ScrollingList) GotoTop()
- func (sl *ScrollingList) HelpView() string
- func (sl ScrollingList) Init() tea.Cmd
- func (sl *ScrollingList) Next()
- func (sl *ScrollingList) PageDown()
- func (sl *ScrollingList) PageUp()
- func (sl *ScrollingList) Prev()
- func (sl *ScrollingList) SetItemAt(item fmt.Stringer, index int)
- func (sl *ScrollingList) SetItems(items []fmt.Stringer)
- func (sl *ScrollingList) SetSize(width, height int)
- func (sl *ScrollingList) TitleView() string
- func (sl ScrollingList) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (sl ScrollingList) View() string
- func (sl *ScrollingList) VisibleLines() []string
Constants ¶
This section is empty.
Variables ¶
View Source
var ( DefaultUnfocusedStyle = lipgloss.NewStyle(). Border(lipgloss.HiddenBorder(), false, false, false, true). PaddingLeft(1). Foreground(lipgloss.AdaptiveColor{Light: "#3d473d", Dark: "#C2B8C2"}) DefaultFocusedStyle = lipgloss.NewStyle(). Border(lipgloss.HiddenBorder(), false, false, false, true). PaddingLeft(1). Foreground(lipgloss.Color("#EE6FF8")) DefaultFocusedLineStyle = lipgloss.NewStyle(). Border(lipgloss.ThickBorder(), false, false, false, true). BorderForeground(lipgloss.Color("#ff0077")). PaddingLeft(1). Foreground(lipgloss.Color("#EE6FF8")) RightArrowBorder = lipgloss.ThickBorder() Background(lipgloss.AdaptiveColor{Light: "#e2e2e2", Dark: "#1D1D1D"}). Foreground(lipgloss.AdaptiveColor{Light: "#984b9e", Dark: "#f7a3fb"}) DefaultTitleStyle = lipgloss.NewStyle(). Foreground(lipgloss.AdaptiveColor{Light: "#e2e2e2", Dark: "#1D1D1D"}). Background(lipgloss.Color("#ff0077")) )
Functions ¶
func InitStyles ¶ added in v1.0.2
func InitStyles()
func PrefixSumBreak ¶
Find an index such that 0 to index just (over)fills valueToReach i.e. the appropriate value - 1
Types ¶
type KeyMap ¶
type KeyMap struct {
Down key.Binding
Up key.Binding
PageDown key.Binding
PageUp key.Binding
GotoBottom key.Binding
GotoTop key.Binding
Quit key.Binding
ShowFullHelp key.Binding
CloseFullHelp key.Binding
ShowHideHelp key.Binding
ToggleTitle key.Binding
}
func DefaultKeyMap ¶
func DefaultKeyMap() KeyMap
type ScrollingList ¶
type ScrollingList struct {
// Styles can be customized
UnfocusedStyle lipgloss.Style
FocusedStyle lipgloss.Style
FocusedLineStyle lipgloss.Style
TitleStyle lipgloss.Style
// Alignment of text within the list
ListAlignment lipgloss.Position
// Alignment of the list and footer w.r.t container
GlobalAlignment lipgloss.Position
// Footer can be toggled and customized, can be multiline
// Title
Title string
// Title can be toggled
ShowTitle bool
Help help.Model
// Help can be toggled
ShowHelp bool
// The number of lines to keep between focused item and screen edges
NumLinesFromBorder int
// Size of the whole list (scroll height is handled automatically based on footer/help)
Width, Height int
// KeyMap
KeyMap KeyMap
// contains filtered or unexported fields
}
func NewScrollingList ¶
func NewScrollingList() ScrollingList
func (*ScrollingList) FooterView ¶
func (sl *ScrollingList) FooterView() string
returns the rendered footer
func (*ScrollingList) GetCurrentVisibleRange ¶ added in v1.0.2
func (sl *ScrollingList) GetCurrentVisibleRange() (int, int)
Returns the currently visible first and last indices
func (*ScrollingList) GetFocused ¶ added in v1.0.2
func (sl *ScrollingList) GetFocused() int
Returns the currently focused index
func (*ScrollingList) HelpView ¶ added in v1.0.2
func (sl *ScrollingList) HelpView() string
returns the rendered help
func (ScrollingList) Init ¶
func (sl ScrollingList) Init() tea.Cmd
BubbleTea Init method, does nothing
func (*ScrollingList) PageDown ¶ added in v1.0.2
func (sl *ScrollingList) PageDown()
Move 1 page down
func (*ScrollingList) SetItemAt ¶ added in v1.0.2
func (sl *ScrollingList) SetItemAt(item fmt.Stringer, index int)
Replace one item at index int with given item
func (*ScrollingList) SetItems ¶
func (sl *ScrollingList) SetItems(items []fmt.Stringer)
Replace all items
func (*ScrollingList) SetSize ¶ added in v1.0.2
func (sl *ScrollingList) SetSize(width, height int)
Set the width and height for list and set initialized
func (*ScrollingList) TitleView ¶ added in v1.0.2
func (sl *ScrollingList) TitleView() string
func (ScrollingList) View ¶
func (sl ScrollingList) View() string
BubbleTea View method, returns the actual final rendering result
func (*ScrollingList) VisibleLines ¶
func (sl *ScrollingList) VisibleLines() []string
returns the visible lines, with partial first/last elements s.t. output fits on screen
Click to show internal directories.
Click to hide internal directories.