Documentation
¶
Index ¶
- type KeyMap
- type Model
- func (m Model) Cursor() int
- func (m Model) CursorIsAtBottom() bool
- func (m Model) CursorIsAtTop() bool
- func (m Model) CursorIsPastBottom() bool
- func (m *Model) GoBottom()
- func (m *Model) GoDown()
- func (m *Model) GoLeft()
- func (m *Model) GoPageDown()
- func (m *Model) GoPageUp()
- func (m *Model) GoRight()
- func (m *Model) GoTop()
- func (m *Model) GoUp()
- func (m Model) SelectedRow() Row
- func (m *Model) SetRows(rows []Row)
- func (m *Model) SetSize(width, height int)
- func (m Model) Update(msg tea.Msg) (Model, tea.Cmd)
- func (m Model) View() string
- type Row
- type SimpleRow
- type Styles
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type KeyMap ¶
type KeyMap struct {
End key.Binding
Home key.Binding
PageDown key.Binding
PageUp key.Binding
Down key.Binding
Up key.Binding
Right key.Binding
Left key.Binding
}
KeyMap holds the key bindings for the table.
type Model ¶
Model of a table component.
func (Model) CursorIsAtBottom ¶
CursorIsAtBottom of the table.
func (Model) CursorIsPastBottom ¶
CursorIsPastBottom of the table.
func (*Model) GoDown ¶
func (m *Model) GoDown()
GoDown moves the selection to the next row. It can not go below the last row.
func (*Model) GoPageDown ¶
func (m *Model) GoPageDown()
GoPageDown moves the selection one page down. It can not go below the last row.
func (*Model) GoPageUp ¶
func (m *Model) GoPageUp()
GoPageUp moves the selection one page up. It can not go above the first row.
func (*Model) GoUp ¶
func (m *Model) GoUp()
GoUp moves the selection to the previous row. It can not go above the first row.
func (Model) SelectedRow ¶
SelectedRow returns the selected row. You can cast it to your own implementation.
func (*Model) SetRows ¶
SetRows of the table and makes sure to update the view and the selected row does not go out of bounds.
func (*Model) SetSize ¶
SetSize of the table and makes sure to update the view and the selected row does not go out of bounds.
type Row ¶
type Row interface {
// Render the row into the given tabwriter.
// To render correctly, join each cell by a tab character '\t'.
// Use `m.Cursor() == index` to determine if the row is selected.
// Take a look at the `SimpleRow` implementation for an example.
Render(w io.Writer, model Model, index int)
}
Row renderer.