header

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Model

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

Model defines a header TUI component

func New

func New(title string, opts ...Option) *Model

New creates a new model with a given title. Further customization can be achieved by providing additional options:

hdr := New("bubbles", WithDesc("a collection of TUI components"))

func (*Model) Height

func (m *Model) Height() int

Height returns the current height of the header

func (*Model) Init

func (*Model) Init() tea.Cmd

Init initialises the header

func (*Model) Resize

func (m *Model) Resize(width, _ int) bubbles.Model

Resize the dimensions of the header

func (*Model) Update

func (m *Model) Update(_ tea.Msg) (tea.Model, tea.Cmd)

Update the current header

func (*Model) View

func (m *Model) View() string

View displays the header

func (*Model) Width

func (m *Model) Width() int

Width returns the current width of the header

type Option

type Option func(*Model)

Option defines options when creating a new model

func WithBorder

func WithBorder() Option

WithBorder provides an option for setting and displaying a border that underlines the header. This border will always be the width of the terminal

func WithDesc

func WithDesc(desc string) Option

WithDesc provides an option for setting and displaying a description underneath the header title. An empty string is ignored

func WithVersion

func WithVersion(ver string) Option

WithVersion provides an option for setting and displaying a version alongside the header title. An empty string is ignored

Jump to

Keyboard shortcuts

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