view

package
v1.49.1 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Fragment

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

Fragment represents a UI element

func NewFragment

func NewFragment(content any) *Fragment

NewFragment constructs a new fragment from its un-styled content

func (Fragment) Render

func (f Fragment) Render() string

Render this fragment as a string, applying its style

func (Fragment) String

func (f Fragment) String() string

String returns the rendered fragment as a string

func (*Fragment) WithStyle

func (f *Fragment) WithStyle(style lipgloss.Style, styles ...lipgloss.Style) *Fragment

WithStyle adds a style to this fragment, which will be used when rendering

type View

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

func New

func New(opts ...ViewOption) *View

New returns a new view.

func (*View) Add

func (v *View) Add(format string, a ...any) *Fragment

Add formats according to a format specifier and appends the resulting string to the view.

func (*View) Addln

func (v *View) Addln(format string, a ...any) *Fragment

Addln formats according to a format specifier and appends the resulting string to the view, followed by a new line.

func (*View) Break

func (v *View) Break()

Break appends a new line fragment to the view.

func (*View) Render

func (v *View) Render() string

Render the view as a string, applying the style.

func (*View) WithNewline

func (v *View) WithNewline(newline string) *View

WithNewline sets a custom newline string for the view.

func (*View) WithStyle

func (v *View) WithStyle(style lipgloss.Style) *View

WithStyle applies/updates the style of the view.

type ViewOption

type ViewOption func(*View)

ViewOption is a function that configures a view.

func WithNewline

func WithNewline(newline string) ViewOption

WithNewline sets a custom newline string for the view.

func WithStyle

func WithStyle(style lipgloss.Style) ViewOption

WithStyle applies/updates the style of the view.

Jump to

Keyboard shortcuts

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