list

package
v0.266.0 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2026 License: MIT Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Item

type Item struct {
	TitleText string
	DescText  string
	Filter    string
	ID        string
	Index     int
}

Item is a generic list row carrying display text plus an id/index payload.

func (Item) Description

func (i Item) Description() string

Description implements list.DefaultItem.

func (Item) FilterValue

func (i Item) FilterValue() string

FilterValue implements list.Item.

func (Item) Title

func (i Item) Title() string

Title implements list.DefaultItem.

type List

type List struct {
	Model list.Model
	// contains filtered or unexported fields
}

List wraps a bubbles list.Model.

func New

func New() *List

New creates a list with the themed delegate.

func (*List) IndexAt

func (l *List) IndexAt(row int) int

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) Restyle

func (l *List) Restyle()

Restyle rebuilds the delegate styling from the current theme.

func (*List) SelectID

func (l *List) SelectID(id string) bool

SelectID highlights an item by ID within the currently visible (filtered) rows. It returns false when the filter excludes the item.

func (*List) SelectIndex

func (l *List) SelectIndex(i int)

SelectIndex highlights the item at the given absolute index.

func (*List) Selected

func (l *List) Selected() (Item, bool)

Selected returns the highlighted item and whether one exists.

func (*List) SetCompact

func (l *List) SetCompact(b bool)

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

func (l *List) SetFilterHint(hint string)

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

func (l *List) SetFilterPlaceholder(ph string)

SetFilterPlaceholder sets the example text shown inside the "/" filter input before the user types anything, hinting at what can be matched.

func (*List) SetItems

func (l *List) SetItems(items []Item) tea.Cmd

SetItems replaces the list items.

func (*List) SetSize

func (l *List) SetSize(width, height int)

SetSize sets the list dimensions.

func (*List) SettingFilter

func (l *List) SettingFilter() bool

SettingFilter reports whether the user is currently typing a filter.

func (*List) Update

func (l *List) Update(msg tea.Msg) tea.Cmd

Update forwards a message to the underlying list model.

func (*List) View

func (l *List) View() string

View renders the list.

Jump to

Keyboard shortcuts

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