gentable

package module
v0.0.0-...-9c44224 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2025 License: MPL-2.0 Imports: 9 Imported by: 0

README

gentable

Generics powered bubble tea table

Documentation

Index

Constants

View Source
const HeaderRow int = -1

HeaderRow denotes the header's row index used when rendering headers. Use this value when looking to customize header styles in StyleFunc.

Variables

This section is empty.

Functions

This section is empty.

Types

type Model

type Model[V comparable] struct {
	// contains filtered or unexported fields
}

func New

func New[V comparable](headers ...string) Model[V]

func (Model) Append

func (m Model) Append(rows ...Row[V])

Append appends rows to the table data.

func (Model) ApplyFilter

func (m Model) ApplyFilter(fn func(V) bool)

func (Model) CursorIndex

func (m Model) CursorIndex() int

func (Model) CursorValue

func (m Model) CursorValue() V

func (Model) DeleteAll

func (w Model) DeleteAll()

DeleteAll deletes all table rows.

func (*Model[V]) EnableDebug

func (t *Model[V]) EnableDebug()

func (*Model[V]) Focus

func (m *Model[V]) Focus(focus bool)

func (*Model[V]) Height

func (m *Model[V]) Height(height int)

Height sets the table height.

func (Model[V]) Init

func (m Model[V]) Init() tea.Cmd

func (Model) PageDown

func (m Model) PageDown()

func (Model) PageUp

func (m Model) PageUp()

func (Model) RemoveFilter

func (m Model) RemoveFilter()

func (*Model[V]) SetSortFunc

func (t *Model[V]) SetSortFunc(fn func(V, V) int)

func (Model[V]) Update

func (m Model[V]) Update(msg tea.Msg) (Model[V], tea.Cmd)

func (Model[V]) View

func (m Model[V]) View() string

type Row

type Row[V comparable] struct {
	V     V
	Cells []string
}

type StyleFunc

type StyleFunc func(row, col int) lipgloss.Style

Jump to

Keyboard shortcuts

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