opentui-spinner[community]
opentui-spinner
opentui-spinner adds an animated loading spinner to OpenTUI applications. The
SpinnerRenderable class joins the OpenTUI Core
renderable tree like any box or text node. It plays more than 80 named
animations from cli-spinners and also accepts custom frames and intervals:
const spinner = new SpinnerRenderable(renderer, {
name: "dots",
color: "cyan",
});
renderer.root.add(spinner);React and Solid applications register a <spinner> element with one
side-effect import and use it with OpenTUI React or
OpenTUI Solid. The element takes the class options
as props: an animation name, custom frames, an interval, autoplay, and colors.
Colors accept named values, RGB objects, hex strings, or a generator function.
The createPulse and createWave helpers build pulse and wave color effects.
All running spinners share one scheduler with wake-ups capped at 60 frames per
second, so staggered spinners can run below their configured rate. The
scheduler suspends hidden spinners, which do not advance frames or request
renders. Intervals must stay between 16.67 and 1000 milliseconds, and invalid
values throw a RangeError.
The README documents the options, the color generators, and the full animation list.