Skip to content

v0.6.0 — spinner

Choose a tag to compare

@ralyodio ralyodio released this 13 Sep 05:30
c78de7c

A spinner widget.

ui.spinner({ label, text }) draws a spinning glyph, a label and an optional right-hand readout on one row. It keeps no timer of its own: the frame comes from the app clock, and while the spinner is active the container asks the app for another frame after this one, so a caller shows a busy line with no interval to manage. active: false settles the line on a done mark without a layout change, so "loading" and "loaded" share a row. Frame sets dots, arc, line and ascii, or your own; terminals without Unicode get ascii and a plain done mark. spinnerFrame() is exported so a status line elsewhere can show the same glyph.

First consumer: gh-pulse show in cli-tools, which fetches a range from GitHub in the background and needed to say it was busy.