Documentation
¶
Index ¶
- Constants
- type Layout
- func (b *Layout) AddLeaf(address string, model tea.Model) (Node, error)
- func (b *Layout) EditLeaf(address string, editFunc func(tea.Model) (tea.Model, error)) error
- func (b *Layout) Init() tea.Cmd
- func (b *Layout) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (b *Layout) UpdateSize(size tea.WindowSizeMsg) error
- func (b *Layout) View() string
- type Node
- type NotFoundError
- type Orientation
- type SizeError
- type SizeFunc
Constants ¶
const ( // NEWLINE is used to separat the lines NEWLINE = "\n" // SPACE is used to fill up the lines, make sure it is only one column wide and a single character SPACE = " " // HorizontalSeparator is used to make a visible border between the horizontal arranged children // in the layout-tree, make sure it is only one column wide and a single character HorizontalSeparator = "│" // VerticalSeparator is used to make a visible border between the vertical arranged children // in the layout-tree, make sure it is only one column wide and a single character VerticalSeparator = "─" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Layout ¶
type Layout struct {
// contains filtered or unexported fields
}
Layout is a way to render multiple `tea.Model“s in a specific layout. The models are kept separate from the layout tree so that changing a Model does not require traversing the tree.
func (*Layout) EditLeaf ¶
EditLeaf is a saver way to interact with the Leafs, since it can not be forgotten to save back the Model after changing. If the editFunc returns an error the Model is not saved.
func (*Layout) UpdateSize ¶
func (b *Layout) UpdateSize(size tea.WindowSizeMsg) error
UpdateSize set the width and height of all Node's
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
Node is a node in a layout tree.
func (*Node) GetAddress ¶
GetAddress returns the Address of the Node The address of a Node is only settable through CreateLeaf
func (*Node) SetSizeFunc ¶
SetSizeFunc sets the function that defines the dynamic width or height of children nodes.
type Orientation ¶
type Orientation uint8
Orientation specifies the rendering orientation.
const ( Horizontal Orientation = iota + 1 Vertical )