Documentation
¶
Overview ¶
Package spinner provides a loading spinner component.
Index ¶
- func ProgressBar(width int, progress float64, label string) string
- func StatusIcon(status string) string
- type LoadingIndicator
- type SpinnerModel
- func (s SpinnerModel) Init() tea.Cmd
- func (s SpinnerModel) IsRunning() bool
- func (s *SpinnerModel) SetText(text string)
- func (s *SpinnerModel) SetThought(thought string)
- func (s *SpinnerModel) Start() tea.Cmd
- func (s *SpinnerModel) Stop()
- func (s SpinnerModel) Update(msg tea.Msg) (SpinnerModel, tea.Cmd)
- func (s SpinnerModel) View() string
- type TickMsg
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ProgressBar ¶
ProgressBar renders a progress bar.
func StatusIcon ¶
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 (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) Update ¶
func (s SpinnerModel) Update(msg tea.Msg) (SpinnerModel, tea.Cmd)
Update handles spinner animation.
Click to show internal directories.
Click to hide internal directories.