Skip to content

ProgressBar

ProgressBar preview

ProgressBar is a horizontal progress bar component.

Constructor func NewProgressBar() *ProgressBar

Usage

bar := components.NewProgressBar().
SetLabel("Uploading").
SetProgress(0.75).
SetShowPercentage(true)
fmt.Println(bar != nil)

Methods

Method Signature Description
GetFieldHeight func (p *ProgressBar) GetFieldHeight() int GetFieldHeight returns the preferred height.
GetProgress func (p *ProgressBar) GetProgress() float64 GetProgress returns the current progress.
SetChars func (p *ProgressBar) SetChars(filled, empty rune) *ProgressBar SetChars sets the filled and empty characters.
SetLabel func (p *ProgressBar) SetLabel(label string) *ProgressBar SetLabel sets the label displayed above the bar.
SetProgress func (p *ProgressBar) SetProgress(progress float64) *ProgressBar SetProgress sets the progress (0.0 to 1.0).
SetShowPercentage func (p *ProgressBar) SetShowPercentage(show bool) *ProgressBar SetShowPercentage enables/disables percentage display.
SetShowValue func (p *ProgressBar) SetShowValue(show bool, current, max float64) *ProgressBar SetShowValue enables value display (current/max).