spinner

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package spinner provides a loading spinner component.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ProgressBar

func ProgressBar(width int, progress float64, label string) string

ProgressBar renders a progress bar.

func StatusIcon

func StatusIcon(status string) string

StatusIcon returns an icon for the given status.

Types

type LoadingIndicator

type LoadingIndicator struct {
	Spinner   SpinnerModel
	Text      string
	Thought   string
	Elapsed   time.Duration
	CancelKey string
}

LoadingIndicator shows a loading message with optional spinner.

func NewLoadingIndicator

func NewLoadingIndicator(text string) LoadingIndicator

NewLoadingIndicator creates a new loading indicator.

func (LoadingIndicator) View

func (l LoadingIndicator) View() string

View renders the loading indicator.

type SpinnerModel

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

SpinnerModel represents a loading spinner.

func NewSpinner

func NewSpinner() SpinnerModel

NewSpinner creates a new spinner.

func (SpinnerModel) Init

func (s SpinnerModel) Init() tea.Cmd

Init initializes the spinner.

func (SpinnerModel) IsRunning

func (s SpinnerModel) IsRunning() bool

IsRunning returns whether the spinner is running.

func (*SpinnerModel) SetText

func (s *SpinnerModel) SetText(text string)

SetText sets the spinner text.

func (*SpinnerModel) SetThought

func (s *SpinnerModel) SetThought(thought string)

SetThought sets the thought text (shown in warning color).

func (*SpinnerModel) Start

func (s *SpinnerModel) Start() tea.Cmd

Start starts the spinner animation.

func (*SpinnerModel) Stop

func (s *SpinnerModel) Stop()

Stop stops the spinner.

func (SpinnerModel) Update

func (s SpinnerModel) Update(msg tea.Msg) (SpinnerModel, tea.Cmd)

Update handles spinner animation.

func (SpinnerModel) View

func (s SpinnerModel) View() string

View renders the spinner.

type TickMsg

type TickMsg struct{}

TickMsg is sent periodically to animate the spinner.

Jump to

Keyboard shortcuts

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