table

package
v0.0.0-...-48f2f3c Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(c *app.Ctx, props ...tableProp) *app.C

NewTable creates a new table component instance.

func Table

func Table(c *app.Ctx, props app.Props) string

Table is the functional component for rendering a table.

func WithDataFunc

func WithDataFunc(f func(c *app.Ctx) (clms []Column, rows []Row)) tableProp

Types

type Column

type Column struct {
	Title string
	Width ColumnWidth
}

type ColumnWidth

type ColumnWidth struct {
	Int  int
	Grow bool
}

func WidthGrow

func WidthGrow() ColumnWidth

func WidthInt

func WidthInt(i int) ColumnWidth

type KeyMap

type KeyMap struct {
	LineUp       key.Binding
	LineDown     key.Binding
	PageUp       key.Binding
	PageDown     key.Binding
	HalfPageUp   key.Binding
	HalfPageDown key.Binding
	GotoTop      key.Binding
	GotoBottom   key.Binding
}

func (KeyMap) FullHelp

func (km KeyMap) FullHelp() [][]key.Binding

func (KeyMap) ShortHelp

func (km KeyMap) ShortHelp() []key.Binding

type Props

type Props struct {
	DataFunc func(c *app.Ctx) (clms []Column, rows []Row)
	KeyMap   KeyMap
	Styles   Styles
	Help     help.Model
	app.Margin
	app.Layout
}

Props holds the configuration for the Table component.

type Row

type Row []string

type Styles

type Styles struct {
	Base      lipgloss.Style
	BaseFocus lipgloss.Style
	Header    lipgloss.Style
	Cell      lipgloss.Style
	Selected  lipgloss.Style
	Hovered   lipgloss.Style // Currently unused
}

Jump to

Keyboard shortcuts

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