spinner

package
v2.0.0-...-2558071 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2025 License: MIT Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Line      = Type(spinner.Line)
	Dots      = Type(spinner.Dot)
	MiniDot   = Type(spinner.MiniDot)
	Jump      = Type(spinner.Jump)
	Points    = Type(spinner.Points)
	Pulse     = Type(spinner.Pulse)
	Globe     = Type(spinner.Globe)
	Moon      = Type(spinner.Moon)
	Monkey    = Type(spinner.Monkey)
	Meter     = Type(spinner.Meter)
	Hamburger = Type(spinner.Hamburger)
	Ellipsis  = Type(spinner.Ellipsis)
)

Functions

This section is empty.

Types

type Spinner

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

Spinner represents a loading spinner. To get started simply create a new spinner and call `Run`.

s := spinner.New()
s.Run()

⣾ Loading...

func New

func New() *Spinner

New creates a new spinner.

func (*Spinner) Action

func (s *Spinner) Action(action func()) *Spinner

Action sets the action of the spinner.

func (*Spinner) ActionWithErr

func (s *Spinner) ActionWithErr(action func(context.Context) error) *Spinner

ActionWithErr sets the action of the spinner.

This is just like Spinner.Action, but allows the action to use a `context.Context` and to return an error.

func (*Spinner) Context

func (s *Spinner) Context(ctx context.Context) *Spinner

Context sets the context of the spinner.

func (*Spinner) Init

func (s *Spinner) Init() tea.Cmd

Init initializes the spinner.

func (*Spinner) Run

func (s *Spinner) Run() error

Run runs the spinner.

func (*Spinner) Title

func (s *Spinner) Title(title string) *Spinner

Title sets the title of the spinner.

func (*Spinner) Type

func (s *Spinner) Type(t Type) *Spinner

Type sets the type of the spinner.

func (*Spinner) Update

func (s *Spinner) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update updates the spinner.

func (*Spinner) View

func (s *Spinner) View() string

View returns the spinner view.

func (*Spinner) WithAccessible

func (s *Spinner) WithAccessible(accessible bool) *Spinner

WithAccessible sets the spinner to be static.

func (*Spinner) WithInput

func (s *Spinner) WithInput(r io.Reader) *Spinner

WithInput set the input for the spinner. Default is STDIN.

func (*Spinner) WithOutput

func (s *Spinner) WithOutput(w io.Writer) *Spinner

WithOutput set the output for the spinner. Default is STDOUT when Spinner.WithAccessible, STDERR otherwise.

func (*Spinner) WithTheme

func (s *Spinner) WithTheme(theme Theme) *Spinner

WithTheme sets the theme for the spinner.

type Styles

type Styles struct {
	Spinner, Title lipgloss.Style
}

Styles are the spinner styles.

func ThemeDefault

func ThemeDefault(isDark bool) *Styles

ThemeDefault is the default theme.

type Theme

type Theme interface {
	Theme(isDark bool) *Styles
}

Theme represents a theme for a huh.

type ThemeFunc

type ThemeFunc func(isDark bool) *Styles

ThemeFunc is a function that returns a new theme.

func (ThemeFunc) Theme

func (f ThemeFunc) Theme(isDark bool) *Styles

Theme implements the Theme interface.

type Type

type Type spinner.Spinner

Type is a set of frames used in animating the spinner.

Jump to

Keyboard shortcuts

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