table

package
v0.0.0-prerelease Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BubbleTable

type BubbleTable struct {
	// contains filtered or unexported fields
}

BubbleTable wraps the advanced bubbles/table component

func NewBubbleTable

func NewBubbleTable(headers []string, styled bool) *BubbleTable

NewBubbleTable creates a new interactive table using bubbles/table with terminal-aware sizing

func (*BubbleTable) AppendData

func (bt *BubbleTable) AppendData(data [][]string)

AppendData adds rows to the table

func (*BubbleTable) GetModel

func (bt *BubbleTable) GetModel() table.Model

GetModel returns the underlying bubbles/table model for use in bubbletea apps

func (*BubbleTable) RenderStatic

func (bt *BubbleTable) RenderStatic() string

RenderStatic renders the table as a static string (non-interactive)

func (*BubbleTable) SetData

func (bt *BubbleTable) SetData(data [][]string)

SetData sets the table data and auto-adjusts column widths based on content

type InteractiveTableModel

type InteractiveTableModel struct {
	// contains filtered or unexported fields
}

InteractiveTableModel implements tea.Model for interactive table display

func NewInteractiveTable

func NewInteractiveTable(headers []string, data [][]string, styled bool) *InteractiveTableModel

NewInteractiveTable creates a new interactive table model

func NewInteractiveTableWithTitle

func NewInteractiveTableWithTitle(title string, headers []string, data [][]string, styled bool) *InteractiveTableModel

NewInteractiveTableWithTitle creates a new interactive table model with custom title

func (*InteractiveTableModel) Init

func (m *InteractiveTableModel) Init() tea.Cmd

func (*InteractiveTableModel) Update

func (m *InteractiveTableModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*InteractiveTableModel) View

func (m *InteractiveTableModel) View() string

type StringBuilderTable

type StringBuilderTable struct {
	*Table
	// contains filtered or unexported fields
}

Custom table that writes directly to strings.Builder

func NewStringBuilderTableWriter

func NewStringBuilderTableWriter(sb *strings.Builder) *StringBuilderTable

NewStringBuilderTableWriter creates a table that writes to a strings.Builder

func (*StringBuilderTable) Render

func (sbt *StringBuilderTable) Render()

Render writes the table directly to the strings.Builder

func (*StringBuilderTable) SetAlignment

func (sbt *StringBuilderTable) SetAlignment(align int)

SetAlignment sets alignment

func (*StringBuilderTable) SetBorders

func (sbt *StringBuilderTable) SetBorders(border any)

SetBorders is a no-op for compatibility

func (*StringBuilderTable) SetCenterSeparator

func (sbt *StringBuilderTable) SetCenterSeparator(sep string)

SetCenterSeparator sets the separator

func (*StringBuilderTable) SetHeader

func (sbt *StringBuilderTable) SetHeader(headers []string)

SetHeader sets the headers and maintains compatibility

type Table

type Table struct {
	// contains filtered or unexported fields
}

Table represents a simple table renderer using lipgloss

func NewPlainTable

func NewPlainTable() *Table

NewPlainTable creates a new table with plain styling (no colors)

func NewStringBuilderTable

func NewStringBuilderTable(sb *strings.Builder) *Table

NewStringBuilderTable creates a table that writes to a strings.Builder

func NewStyledTable

func NewStyledTable() *Table

NewStyledTable creates a new table with colorful styling

func NewTable

func NewTable() *Table

NewTable creates a new table with default (plain) styling

func NewTableWithStyle

func NewTableWithStyle(style TableStyle) *Table

NewTableWithStyle creates a new table with custom styling

func (*Table) AppendBulk

func (t *Table) AppendBulk(rows [][]string)

AppendBulk adds multiple rows to the table

func (*Table) AppendRow

func (t *Table) AppendRow(row []string)

AppendRow adds a single row to the table

func (*Table) Render

func (t *Table) Render() string

Render generates the complete table as a string

func (*Table) RenderToWriter

func (t *Table) RenderToWriter(w fmt.State, verb rune)

RenderToWriter writes the table output to any writer (maintains tablewriter compatibility)

func (*Table) SetAlignment

func (t *Table) SetAlignment(align lipgloss.Position)

SetAlignment sets the alignment for each column

func (*Table) SetAutoWrapText

func (t *Table) SetAutoWrapText(wrap bool)

SetAutoWrapText sets whether text should auto-wrap

func (*Table) SetHeaders

func (t *Table) SetHeaders(headers []string)

SetHeaders sets the table headers

func (*Table) SetStyle

func (t *Table) SetStyle(style TableStyle)

SetStyle changes the table style

func (*Table) UsePlainStyle

func (t *Table) UsePlainStyle()

UsePlainStyle switches to plain (boring) styling

func (*Table) UseStyledStyle

func (t *Table) UseStyledStyle()

UseStyledStyle switches to colorful styling

type TableStyle

type TableStyle struct {
	Header    lipgloss.Style
	Cell      lipgloss.Style
	Border    lipgloss.Style
	Separator string
}

TableStyle defines the visual styling for tables

func DefaultTableStyle

func DefaultTableStyle() TableStyle

DefaultTableStyle returns a plain table styling (for users who hate colors)

func PlainTableStyle

func PlainTableStyle() TableStyle

PlainTableStyle returns a plain, boring table style with no colors

func StyledTableStyle

func StyledTableStyle() TableStyle

StyledTableStyle returns a colorful, styled table

Jump to

Keyboard shortcuts

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