Documentation
¶
Index ¶
- type Column
- type KeyMap
- type Option
- type Row
- type Styles
- type Table
- func (m *Table) Blur()
- func (m Table) Cursor() int
- func (m *Table) Focus()
- func (m Table) Focused() bool
- func (m *Table) FromValues(value, separator string)
- func (m *Table) GotoBottom()
- func (m *Table) GotoTop()
- func (m Table) Height() int
- func (m *Table) MoveDown(n int)
- func (m *Table) MoveUp(n int)
- func (m Table) Rows() []Row
- func (m Table) SelectedRow() Row
- func (m *Table) SetColumns(c []Column)
- func (m *Table) SetCursor(n int)
- func (m *Table) SetHeight(h int)
- func (m *Table) SetRows(r []Row)
- func (m *Table) SetStyles(s Styles)
- func (m *Table) SetWidth(w int)
- func (m Table) Update(msg tea.Msg) (Table, tea.Cmd)
- func (m *Table) UpdateViewport()
- func (m Table) View() string
- func (m Table) Width() int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
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 }
KeyMap defines keybindings. It satisfies to the help.KeyMap interface, which is used to render the menu.
func DefaultKeyMap ¶
func DefaultKeyMap() KeyMap
DefaultKeyMap returns a default set of keybindings.
type Option ¶
type Option func(*Table)
Option is used to set options in New. For example:
table := New(WithColumns([]Column{{Title: "ID", Width: 10}}))
func WithColumns ¶
WithColumns sets the table columns (headers).
type Styles ¶
Styles contains style definitions for this list component. By default, these values are generated by DefaultStyles.
func DefaultStyles ¶
func DefaultStyles() Styles
DefaultStyles returns a set of default style definitions for this table.
type Table ¶
type Table struct { KeyMap KeyMap // contains filtered or unexported fields }
Table defines a state for the table widget.
func (*Table) Focus ¶
func (m *Table) Focus()
Focus focuses the table, allowing the user to move around the rows and interact.
func (*Table) FromValues ¶
FromValues create the table rows from a simple string. It uses `\n` by default for getting all the rows and the given separator for the fields on each row.
func (*Table) GotoBottom ¶
func (m *Table) GotoBottom()
GotoBottom moves the selection to the last row.
func (*Table) MoveDown ¶
MoveDown moves the selection down by any number of rows. It can not go below the last row.
func (*Table) MoveUp ¶
MoveUp moves the selection up by any number of rows. It can not go above the first row.
func (Table) SelectedRow ¶
SelectedRow returns the selected row. You can cast it to your own implementation.
func (*Table) SetColumns ¶
SetColumns sets a new columns state.
func (*Table) UpdateViewport ¶
func (m *Table) UpdateViewport()
UpdateViewport updates the list content based on the previously defined columns and rows.