etui/widgets/spinner

Types

A spinner’s look: frame set, label, and colors.

pub type Spinner {
  Spinner(
    style: SpinnerStyle,
    label: String,
    fg: style.Color,
    bg: style.Color,
  )
}

Constructors

Frame sequences for the spinner. Most are single characters; Points, Meter, and Ellipsis span several cells, so give them room.

pub type SpinnerStyle {
  Dots
  Line
  Circle
  Bounce
  MiniDot
  Jump
  Pulse
  Points
  Globe
  Moon
  Monkey
  Meter
  Hamburger
  Ellipsis
  Custom(frames: List(String))
}

Constructors

  • Dots
  • Line
  • Circle
  • Bounce
  • MiniDot
  • Jump
  • Pulse
  • Points
  • Globe
  • Moon
  • Monkey
  • Meter
  • Hamburger
  • Ellipsis
  • Custom(frames: List(String))

    Your own frame sequence, cycled in order.

Values

pub fn render(
  buf: buffer.Buffer,
  area: geometry.Rect,
  s: Spinner,
  frame: Int,
) -> buffer.Buffer

Write the frame character (plus label) at the area’s top-left corner.

pub fn spinner_new() -> Spinner

A plain braille-dots spinner with no label.

pub fn with_colors(
  s: Spinner,
  fg: style.Color,
  bg: style.Color,
) -> Spinner

Colors of the spinner and its label.

pub fn with_label(s: Spinner, label: String) -> Spinner

Text drawn to the right of the spinning character, one space apart.

pub fn with_render_style(s: Spinner, st: style.Style) -> Spinner

Take only fg/bg from a Style.

pub fn with_style(
  s: Spinner,
  spinner_style: SpinnerStyle,
) -> Spinner

Pick the frame sequence.

✨ Search Document