Documentation ΒΆ
Index ΒΆ
- Constants
- func DefaultColumns() []column
- func DefaultRows() []naiveRow
- func NewCell(value string) cell
- func NewHeaderList(opts ...func(*headerList)) headerList
- func NewTableModelBuilder() *tableModelBuilder
- func WithItems(items []list.Item) func(*headerList)
- func WithTables(tables []TableModel) func(*headerList)
- func Write(m Model)
- type Model
- type Option
- type TableModel
- func (m TableModel) Cursor() int
- func (m TableModel) Height() int
- func (m TableModel) Rows() []row
- func (m TableModel) SelectedRow() row
- func (m *TableModel) SetColumns(c []column)
- func (m *TableModel) SetCursor(n int)
- func (m *TableModel) SetHeight(h int)
- func (m *TableModel) SetRows(r []row)
- func (m *TableModel) SetStyles(s tableStyles)
- func (m *TableModel) SetWidth(w int)
- func (m TableModel) Update(msg tea.Msg) (TableModel, tea.Cmd)
- func (m TableModel) View() string
- func (m TableModel) Width() int
- type TableOption
- func WithColumns(cols []column) TableOption
- func WithFocused(f bool) TableOption
- func WithHeight(h int) TableOption
- func WithKeyMap(km keyMap) TableOption
- func WithNaiveRows(rows []naiveRow) TableOption
- func WithRows(rows []row) TableOption
- func WithStyles(s tableStyles) TableOption
- func WithWidth(w int) TableOption
Constants ΒΆ
const ( NORMAL = iota INSERT HEADER HEADER_INSERT HELP )
Enum of Mode
Variables ΒΆ
This section is empty.
Functions ΒΆ
func DefaultColumns ΒΆ
func DefaultColumns() []column
func DefaultRows ΒΆ
func DefaultRows() []naiveRow
func NewHeaderList ΒΆ
func NewHeaderList(opts ...func(*headerList)) headerList
func NewTableModelBuilder ΒΆ
func NewTableModelBuilder() *tableModelBuilder
func WithTables ΒΆ
func WithTables(tables []TableModel) func(*headerList)
Types ΒΆ
type TableModel ΒΆ
type TableModel struct {
// contains filtered or unexported fields
}
TableModel defines a state for the table widget.
func NewTableModel ΒΆ
func NewTableModel(opts ...TableOption) TableModel
NewTableModel creates a new model for the table widget.
func (TableModel) Cursor ΒΆ
func (m TableModel) Cursor() int
Cursor returns the index of the selected row.
func (TableModel) Height ΒΆ
func (m TableModel) Height() int
Height returns the viewport height of the table.
func (TableModel) SelectedRow ΒΆ
func (m TableModel) SelectedRow() row
SelectedRow returns the selected row. You can cast it to your own implementation.
func (*TableModel) SetColumns ΒΆ
func (m *TableModel) SetColumns(c []column)
SetColumns sets a new columns state.
func (*TableModel) SetCursor ΒΆ
func (m *TableModel) SetCursor(n int)
SetCursor sets the cursor.y position in the table.
func (*TableModel) SetHeight ΒΆ
func (m *TableModel) SetHeight(h int)
SetHeight sets the height of the viewport of the table.
func (*TableModel) SetStyles ΒΆ
func (m *TableModel) SetStyles(s tableStyles)
SetStyles sets the table styles.
func (*TableModel) SetWidth ΒΆ
func (m *TableModel) SetWidth(w int)
SetWidth sets the width of the viewport of the table.
func (TableModel) Update ΒΆ
func (m TableModel) Update(msg tea.Msg) (TableModel, tea.Cmd)
Update is the Bubble Tea update loop.
func (TableModel) Width ΒΆ
func (m TableModel) Width() int
Width returns the viewport width of the table.
type TableOption ΒΆ
type TableOption func(*TableModel)
TableOption is used to set options in New. For example:
table := New(WithColumns([]Column{{Title: "ID", Width: 10}}))
func WithColumns ΒΆ
func WithColumns(cols []column) TableOption
WithColumns sets the table columns (headers).
func WithFocused ΒΆ
func WithFocused(f bool) TableOption
WithFocused sets the focus state of the table.
func WithNaiveRows ΒΆ
func WithNaiveRows(rows []naiveRow) TableOption