Documentation
¶
Index ¶
- type Column
- type Model
- func (m *Model[T]) Blur()
- func (m Model[T]) Columns() []Column[T]
- func (m Model[T]) Cursor() int
- func (m *Model[T]) Focus()
- func (m Model[T]) Focused() bool
- func (m *Model[T]) GotoBottom()
- func (m *Model[T]) GotoTop()
- func (m Model[T]) Height() int
- func (m Model[T]) HelpView() string
- func (m *Model[T]) MoveDown(n int)
- func (m *Model[T]) MoveUp(n int)
- func (m Model[T]) Rows() []T
- func (m Model[T]) SelectedRow() T
- func (m *Model[T]) SetColumns(c []Column[T])
- func (m *Model[T]) SetCursor(n int)
- func (m *Model[T]) SetHeight(h int)
- func (m *Model[T]) SetRows(r []T)
- func (m *Model[T]) SetStyles(s teaModel.Styles)
- func (m *Model[T]) SetWidth(w int)
- func (m Model[T]) Update(msg tea.Msg) (Model[T], tea.Cmd)
- func (m *Model[T]) UpdateViewport()
- func (m Model[T]) View() string
- func (m Model[T]) Width() int
- type Option
- func WithColumns[T any](cols []Column[T]) Option[T]
- func WithFocused[T any](f bool) Option[T]
- func WithHeight[T any](h int) Option[T]
- func WithKeyMap[T any](km teaModel.KeyMap) Option[T]
- func WithRows[T any](rows []T) Option[T]
- func WithStyles[T any](s teaModel.Styles) Option[T]
- func WithWidth[T any](w int) Option[T]
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Model ¶
type Model[T any] struct { KeyMap teaModel.KeyMap Help help.Model // contains filtered or unexported fields }
Model defines a state for the table widget.
func (*Model[T]) Blur ¶
func (m *Model[T]) Blur()
Blur blurs the table, preventing selection or movement.
func (*Model[T]) Focus ¶
func (m *Model[T]) Focus()
Focus focuses the table, allowing the user to move around the rows and interact.
func (*Model[T]) GotoBottom ¶
func (m *Model[T]) GotoBottom()
GotoBottom moves the selection to the last row.
func (*Model[T]) GotoTop ¶
func (m *Model[T]) GotoTop()
GotoTop moves the selection to the first row.
func (Model[T]) HelpView ¶
HelpView is a helper method for rendering the help menu from the keymap. Note that this view is not rendered by default and you must call it manually in your application, where applicable.
func (*Model[T]) MoveDown ¶
MoveDown moves the selection down by any number of rows. It can not go below the last row.
func (*Model[T]) MoveUp ¶
MoveUp moves the selection up by any number of rows. It can not go above the first row.
func (Model[T]) SelectedRow ¶
func (m Model[T]) SelectedRow() T
SelectedRow returns the selected row. You can cast it to your own implementation.
func (*Model[T]) SetColumns ¶
SetColumns sets a new columns state.
func (*Model[T]) UpdateViewport ¶
func (m *Model[T]) UpdateViewport()
UpdateViewport updates the list content based on the previously defined columns and rows.
type Option ¶
func WithColumns ¶
WithColumns sets the table columns (headers).
func WithFocused ¶
WithFocused sets the focus state of the table.
func WithStyles ¶
WithStyles sets the table styles.