Documentation ¶
Index ¶
- type Layout
- func (l *Layout) GetActive() *PositionalElement
- func (l *Layout) Init() tea.Cmd
- func (l *Layout) NavigateDown()
- func (l *Layout) NavigateLeft()
- func (l *Layout) NavigateRight()
- func (l *Layout) NavigateUp()
- func (l *Layout) Resize(width, height int)
- func (l *Layout) SetActive(x, y int)
- func (l *Layout) UpdateActive(msg tea.Msg) tea.Cmd
- func (l *Layout) UpdateAll(msg tea.Msg) tea.Cmd
- func (l *Layout) View() string
- type LayoutModel
- type Position
- type PositionalElement
- type Row
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Layout ¶
type Layout struct {
// contains filtered or unexported fields
}
The Layout struct provides a way of arranging and displaying multiple components in a single view with the ability to navigate between them.
func (*Layout) GetActive ¶
func (l *Layout) GetActive() *PositionalElement
Get a reference to the active element
func (*Layout) NavigateDown ¶
func (l *Layout) NavigateDown()
func (*Layout) NavigateLeft ¶
func (l *Layout) NavigateLeft()
func (*Layout) NavigateRight ¶
func (l *Layout) NavigateRight()
func (*Layout) NavigateUp ¶
func (l *Layout) NavigateUp()
func (*Layout) UpdateActive ¶
Update only the active element with the provided message
type LayoutModel ¶
type LayoutModel interface { // tea.Model Init() tea.Cmd Update(tea.Msg) (tea.Model, tea.Cmd) View() string IsActive() bool SetActive() LayoutModel UnsetActive() LayoutModel // This method gets called with the actual with the component // will have available. This is useful when you use fill-mode // and do not have a fixed width. OnAvailWidthChange(width int) LayoutModel }
Extends the normal tea.Model with methods set and unset it as active element.
type PositionalElement ¶
type PositionalElement struct {
// contains filtered or unexported fields
}
The PositionalElement is a wrapper around the model that should be displayed. It holds extra metadata.
func Fill ¶
func Fill(model *LayoutModel, position Position, width float64) PositionalElement
Fill width dynamically. position: left | center | right width: fraction of how much space to take, e.g. 0.5 for 50%
func FillAuto ¶
func FillAuto(model *LayoutModel, position Position) PositionalElement
Fill width dynamically. Split space equally among fill-auto elements position: left | center | right
func Fixed ¶
func Fixed(model *LayoutModel, position Position, width int) PositionalElement
Fixed width.
func (*PositionalElement) IsSelectable ¶
func (p *PositionalElement) IsSelectable() bool
Check if an element is selectable
func (PositionalElement) NotSelectable ¶
func (p PositionalElement) NotSelectable() PositionalElement
Element cannot be selected by user
type Row ¶
type Row struct {
// contains filtered or unexported fields
}
Provides one Row in the Layout Make sure that all rows have the same number of elements. You can use an "empty" element to fill the gaps.