cup

package
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 6, 2025 License: MPL-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package cup provides some "cup"s: a component can hold another component.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BorderConfig

type BorderConfig struct {
	Left, Top, Right, Bottom bool
	VerticalLine             rune
	HorizontalLine           rune
	TopLeftCorner            rune
	TopRightCorner           rune
	BottomLeftCorner         rune
	BottomRightCorner        rune
}

func DefaultBorderConfig

func DefaultBorderConfig() BorderConfig

type BorderedBox

type BorderedBox struct {
	BorderConfig
	// contains filtered or unexported fields
}

func NewBorderedBox

func NewBorderedBox(inner tea.Model) *BorderedBox

func NewBorderedBoxWithCaption added in v0.0.2

func NewBorderedBoxWithCaption(inner tea.Model, caption string) *BorderedBox

func (*BorderedBox) Init

func (b *BorderedBox) Init() tea.Cmd

func (*BorderedBox) SetCaption added in v0.0.2

func (b *BorderedBox) SetCaption(c string)

func (*BorderedBox) Setter added in v0.0.2

func (b *BorderedBox) Setter(send func(tea.Msg)) func(string)

func (*BorderedBox) Update

func (b *BorderedBox) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*BorderedBox) View

func (b *BorderedBox) View() string

type BorderedBoxSetCaptionMsg added in v0.0.2

type BorderedBoxSetCaptionMsg struct {
	// contains filtered or unexported fields
}

type FixedLayout

type FixedLayout struct {
	// contains filtered or unexported fields
}

FixedLayout is a layout that reserves a fixed amount of space for one component and gives the rest of the space to the other component.

func FixedBottomLayout

func FixedBottomLayout(reserve int, top, bottom tea.Model) *FixedLayout

FixedBottomLayout reserves space on the bottom side of the layout.

func FixedLeftLayout

func FixedLeftLayout(reserve int, left, right tea.Model) *FixedLayout

FixedLeftLayout reserves space on the left side of the layout.

func FixedRightLayout

func FixedRightLayout(reserve int, left, right tea.Model) *FixedLayout

FixedRightLayout reserves space on the right side of the layout.

func FixedTopLayout

func FixedTopLayout(reserve int, top, bottom tea.Model) *FixedLayout

FixedTopLayout reserves space on the top side of the layout.

func PadBottom

func PadBottom(reserve int, component tea.Model) *FixedLayout

PadBottom is a convenience function to add padding to the bottom of a component.

func PadLeft

func PadLeft(reserve int, component tea.Model) *FixedLayout

PadLeft is a convenience function to add padding to the left of a component.

func PadRight

func PadRight(reserve int, component tea.Model) *FixedLayout

PadRight is a convenience function to add padding to the right of a component.

func PadTop

func PadTop(reserve int, component tea.Model) *FixedLayout

PadTop is a convenience function to add padding to the top of a component.

func (*FixedLayout) Init

func (f *FixedLayout) Init() tea.Cmd

func (*FixedLayout) Update

func (f *FixedLayout) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*FixedLayout) View

func (f *FixedLayout) View() string

type GridLayout

type GridLayout struct {
	// contains filtered or unexported fields
}

GridLayout is a layout manager that arranges components in a grid.

It separates the available space into a grid of cells and places components into these cells evenly based on their specified positions and spans.

For example, a terminal screen of width 80 and height 24, with a grid layout of 4 columns and 3 rows, would divide the screen into cells of width 20 and height 8. A component added at position (0, 0) with a span of (2, 1) would occupy the area from (0, 0) to (39, 7) inclusive.

Warning: The minimum valid size for a cell is (1, 1), NO FLOAT POINT ACCEPTED.

func NewGridLayout

func NewGridLayout(w, h int) *GridLayout

NewGridLayout creates a new GridLayout with the specified number of columns (w) and rows (h). Both w and h must be greater than zero.

func (*GridLayout) Add

func (g *GridLayout) Add(comp tea.Model, x, y, w, h int) bool

func (*GridLayout) Init

func (g *GridLayout) Init() tea.Cmd

func (*GridLayout) Update

func (g *GridLayout) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*GridLayout) View

func (g *GridLayout) View() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL