Documentation
¶
Overview ¶
Package list wraps bubbles/list with a task-pilot-style delegate: a thick left-border selection accent, title+description rows, and built-in filtering. Styling is driven by the active theme and can be refreshed via Restyle.
Index ¶
- type Item
- type List
- func (l *List) IndexAt(row int) int
- func (l *List) ResetFilter()
- func (l *List) Restyle()
- func (l *List) ResyncFilter()
- func (l *List) SelectID(id string) bool
- func (l *List) SelectIndex(i int)
- func (l *List) Selected() (Item, bool)
- func (l *List) SetCompact(b bool)
- func (l *List) SetFilterHint(hint string)
- func (l *List) SetFilterPlaceholder(ph string)
- func (l *List) SetFilterPrompt(p string)
- func (l *List) SetItems(items []Item)
- func (l *List) SetSize(width, height int)
- func (l *List) SettingFilter() bool
- func (l *List) Update(msg tea.Msg) tea.Cmd
- func (l *List) View() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Item ¶
Item is a generic list row carrying display text plus an id/index payload.
func (Item) Description ¶
Description implements list.DefaultItem.
type List ¶
List wraps a bubbles list.Model.
func (*List) IndexAt ¶
IndexAt maps a 0-based visible row (from the top of the rendered list) to the absolute item index, or -1 if the row is past the last visible item. It accounts for the delegate's item height + spacing and the current page.
func (*List) ResetFilter ¶ added in v0.267.0
func (l *List) ResetFilter()
ResetFilter clears an applied "/" filter and puts the title bar back to its key hint. Callers must not reach through to Model.ResetFilter, which leaves the title naming a filter that is no longer applied.
func (*List) Restyle ¶
func (l *List) Restyle()
Restyle rebuilds the delegate styling from the current theme.
func (*List) ResyncFilter ¶ added in v0.268.0
func (l *List) ResyncFilter()
ResyncFilter recomputes the filtered matches synchronously. bubbles hands the re-run back as a command for a running program to execute; a caller driving the list without a bubbletea runtime never runs it, so the visible items would lag a keystroke behind. Safe to reapply inline for the same reason SetItems does it: pure matching over items already set.
func (*List) SelectID ¶
SelectID highlights an item by ID within the currently visible (filtered) rows. It returns false when the filter excludes the item.
func (*List) SelectIndex ¶
SelectIndex highlights the item at the given absolute index.
func (*List) SetCompact ¶
SetCompact toggles single-line rows (title only, no inter-row spacing) and restyles. Callers that want the description folded into the row build a combined single-line title before SetItems; this only controls the delegate.
func (*List) SetFilterHint ¶
SetFilterHint sets the faint helper text shown in place of the title while the user is not actively filtering, advertising the "/" filter. It is only shown when the list has items; an empty list shows nothing.
func (*List) SetFilterPlaceholder ¶
SetFilterPlaceholder sets the example text shown inside the "/" filter input before the user types anything, hinting at what can be matched.
func (*List) SetFilterPrompt ¶ added in v0.267.0
SetFilterPrompt overrides the "filter: " label shown at the head of the "/" input.
func (*List) SetItems ¶
SetItems replaces the list items, re-running an applied "/" filter over them.
bubbles hands that re-run back as a command carrying a FilterMatchesMsg, but that message is applied by whichever list receives it — so a caller that routes messages by "the section on screen" can hand one list's matches to another, or drop it entirely and leave a filtered list rendering nothing. It is pure fuzzy matching over the items just set, with nothing to wait on, so it runs inline here instead and never escapes. (bubbles does the same in its own Model.SetFilterText.)
func (*List) SettingFilter ¶
SettingFilter reports whether the user is currently typing a filter.