Elegant CLI Spinner Frames

3.0.0 · maintenance · verified Wed Apr 22

elegant-spinner provides a simple, elegant set of ASCII frames designed for creating visual loading indicators in interactive command-line interface (CLI) applications. The current stable version is 3.0.0. This package itself does not handle the animation logic; rather, it supplies the individual spinner frames that an external utility (like `log-update` or `ora`) can iterate through to create an animated effect. Its release cadence is tied to Node.js compatibility updates and essential maintenance, rather than rapid feature development. A key differentiator is its minimalism, focusing solely on the spinner frames. However, for most use cases requiring a full-fledged animated spinner, the `ora` package is recommended as it bundles `elegant-spinner` and manages the animation loop automatically. It supports modern Node.js environments and is pure ESM since version 3.0.0, with TypeScript definitions available since version 2.0.0.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates how to import the `elegantSpinner` function and use it with `log-update` to render a basic animated spinner in the terminal, manually updating frames every 50ms and showing a progress percentage.

import elegantSpinner from 'elegant-spinner';
import logUpdate from 'log-update';

const spinnerFrames = elegantSpinner();
let counter = 0;
const interval = setInterval(() => {
  const currentFrame = spinnerFrames();
  logUpdate(`Loading ${currentFrame} ${counter++}%`);
  if (counter > 100) {
    clearInterval(interval);
    logUpdate.done();
    console.log('Loading complete!');
  }
}, 50);

view raw JSON →