model

package
v0.0.0-...-a02a1e0 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Base

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

Base provides basic helper functionality for all (non-view) models. It should be a field in all models but cannot be embedded in the idiomatic Go manner. This has the advantage of the parent being able to control which of the Base methods are exposed. Maybe it is possible to do embedded though? Open to suggestions!

func (Base) AvailableWidth

func (b Base) AvailableWidth() int

AvailableWidth returns the width of the block minus the margins.

func (*Base) Height

func (b *Base) Height(height int) *Base

Pass through to lipgloss.Style Height Height sets the height of the block before applying margins. If the height of the text block is less than this value after applying padding (or not), the block will be set to this height.

func (*Base) Margin

func (b *Base) Margin(i ...int) *Base

Pass through to lipgloss.Style Margin Margin is a shorthand method for setting margins on all sides at once.

With one argument, the value is applied to all sides.

With two arguments, the value is applied to the vertical and horizontal sides, in that order.

With three arguments, the value is applied to the top side, the horizontal sides, and the bottom side, in that order.

With four arguments, the value is applied clockwise starting from the top side, followed by the right side, then the bottom, and finally the left.

With more than four arguments no margin will be added.

func (Base) NewStyle

func (b Base) NewStyle() lipgloss.Style

Returns a new lipgloss.Style with all base fields set.

func (*Base) Width

func (b *Base) Width(width int) *Base

Pass through to lipgloss.Style Width Width sets the width of the block before applying margins. The width, if set, also determines where text will wrap.

Jump to

Keyboard shortcuts

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