components

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package components provides reusable TUI components

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Footer struct {
	HelpBindings []key.Binding
	ShowQuit     bool
	Width        int
	// contains filtered or unexported fields
}

Footer represents the app footer component with help

func NewFooter

func NewFooter() *Footer

NewFooter creates a new footer component

func (*Footer) SetBindings

func (f *Footer) SetBindings(bindings []key.Binding) *Footer

SetBindings sets the help key bindings

func (*Footer) SetShowQuit

func (f *Footer) SetShowQuit(show bool) *Footer

SetShowQuit sets whether to show quit help

func (*Footer) SetWidth

func (f *Footer) SetWidth(width int) *Footer

SetWidth sets the footer width

func (*Footer) View

func (f *Footer) View() string

View renders the footer

type Header struct {
	Title           string
	Subtitle        string
	IsAuthenticated bool
	Username        string
	Width           int
	// contains filtered or unexported fields
}

Header represents the app header component

func NewHeader

func NewHeader() *Header

NewHeader creates a new header component

func (*Header) SetAuth

func (h *Header) SetAuth(authenticated bool, username string) *Header

SetAuth sets the authentication state

func (*Header) SetSubtitle

func (h *Header) SetSubtitle(subtitle string) *Header

SetSubtitle sets the header subtitle

func (*Header) SetTitle

func (h *Header) SetTitle(title string) *Header

SetTitle sets the header title

func (*Header) SetWidth

func (h *Header) SetWidth(width int) *Header

SetWidth sets the header width

func (*Header) View

func (h *Header) View() string

View renders the header

type HelpItem

type HelpItem struct {
	Key   string
	Value string
}

HelpItem represents a single help item

type ProgressBar

type ProgressBar struct {
	Label   string
	Current int
	Total   int
	Width   int
	ShowPct bool
	// contains filtered or unexported fields
}

ProgressBar represents a progress bar component

func NewProgressBar

func NewProgressBar() *ProgressBar

NewProgressBar creates a new progress bar

func (*ProgressBar) SetLabel

func (p *ProgressBar) SetLabel(label string) *ProgressBar

SetLabel sets the progress label

func (*ProgressBar) SetProgress

func (p *ProgressBar) SetProgress(current, total int) *ProgressBar

SetProgress sets the current progress

func (*ProgressBar) SetShowPct

func (p *ProgressBar) SetShowPct(show bool) *ProgressBar

SetShowPct sets whether to show percentage

func (*ProgressBar) SetWidth

func (p *ProgressBar) SetWidth(width int) *ProgressBar

SetWidth sets the progress bar width

func (*ProgressBar) View

func (p *ProgressBar) View() string

View renders the progress bar

type ProgressItem

type ProgressItem struct {
	Name   string
	Status ProgressStatus
	Detail string
}

ProgressItem represents a single progress item in a list

type ProgressList

type ProgressList struct {
	Title  string
	Items  []ProgressItem
	Width  int
	Height int
	// contains filtered or unexported fields
}

ProgressList represents a list of progress items

func NewProgressList

func NewProgressList() *ProgressList

NewProgressList creates a new progress list

func (*ProgressList) AddItem

func (p *ProgressList) AddItem(name string, status ProgressStatus, detail string) *ProgressList

AddItem adds an item to the list

func (*ProgressList) ClearItems

func (p *ProgressList) ClearItems() *ProgressList

ClearItems clears all items

func (*ProgressList) Counters

func (p *ProgressList) Counters() map[ProgressStatus]int

Counters returns the count of items by status

func (*ProgressList) SetDimensions

func (p *ProgressList) SetDimensions(width, height int) *ProgressList

SetDimensions sets the list dimensions

func (*ProgressList) SetTitle

func (p *ProgressList) SetTitle(title string) *ProgressList

SetTitle sets the list title

func (*ProgressList) Summary

func (p *ProgressList) Summary() string

Summary returns a summary string

func (*ProgressList) UpdateItem

func (p *ProgressList) UpdateItem(index int, status ProgressStatus, detail string) *ProgressList

UpdateItem updates an existing item

func (*ProgressList) View

func (p *ProgressList) View() string

View renders the progress list

type ProgressStatus

type ProgressStatus int

ProgressStatus represents the status of a progress item

const (
	StatusPending ProgressStatus = iota
	StatusInProgress
	StatusSuccess
	StatusWarning
	StatusError
	StatusSkipped
)

type SimpleFooter

type SimpleFooter struct {
	Items    []HelpItem
	ShowQuit bool
	Width    int
	// contains filtered or unexported fields
}

SimpleFooter creates a footer from simple key/value pairs

func NewSimpleFooter

func NewSimpleFooter() *SimpleFooter

NewSimpleFooter creates a new simple footer

func (*SimpleFooter) AddItem

func (f *SimpleFooter) AddItem(key, value string) *SimpleFooter

AddItem adds a help item

func (*SimpleFooter) SetShowQuit

func (f *SimpleFooter) SetShowQuit(show bool) *SimpleFooter

SetShowQuit sets whether to show quit help

func (*SimpleFooter) SetWidth

func (f *SimpleFooter) SetWidth(width int) *SimpleFooter

SetWidth sets the footer width

func (*SimpleFooter) View

func (f *SimpleFooter) View() string

View renders the footer

Jump to

Keyboard shortcuts

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