Install cli-spinners via npm
mainInstall the cli-spinners package using npm to access a collection of over 70 terminal spinners.
npm install cli-spinnersrepository·main·Indexed 25 days ago
https://github.com/sindresorhus/cli-spinnersA collection of over 70 terminal spinner configurations, providing frame arrays and timing intervals. Designed as a data source for terminal spinner implementations like ora, it includes the cliSpinners object for specific spinner access and a randomSpinner() function for retrieving random spinner objects.
Install the cli-spinners package using npm to access a collection of over 70 terminal spinners.
npm install cli-spinnersImport the default cliSpinners export to access individual spinner objects. Each spinner object contains an interval (the time per frame in milliseconds) and a frames array (the sequence of characters to display).
import cliSpinners from 'cli-spinners';
console.log(cliSpinners.dots);
/*
{
interval: 80,
frames: ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏']
}
*/The default export of this module is the spinners object, which contains all available spinner data. Each key in the object is a spinner name, and the value is an object containing the frames array and the text associated with that spinner. To use it in an ESM environment, import it using the JSON module type.
import spinners from './spinners.json' with {type: 'json'};The cliSpinners default export is an object containing over 70 available spinners. Each spinner is accessible via its unique SpinnerName. Each spinner object provides the animation frames and the timing interval required to render it.
import cliSpinners from 'cli-spinners';
console.log(cliSpinners.dots);
// {
// interval: 80,
// frames: ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏']
// }The following string literals are valid SpinnerName keys used to access spinners from the cliSpinners object:
dots
dots2
dots3
dots4
dots5
dots6
dots7
dots8
dots9
dots10
dots11
dots12
dots13
dots14
dots8Bit
dotsCircle
sand
line
line2
rollingLine
pipe
simpleDots
simpleDotsScrolling
star
star2
flip
hamburger
growVertical
growHorizontal
balloon
balloon2
noise
bounce
boxBounce
boxBounce2
binary
triangle
arc
circle
squareCorners
circleQuarters
circleHalves
squish
toggle
toggle2
toggle3
toggle4
toggle5
toggle6
toggle7
toggle8
toggle9
toggle10
toggle11
toggle12
toggle13
arrow
arrow2
arrow3
bouncingBar
bouncingBall
smiley
monkey
hearts
clock
earth
material
moon
runner
pong
shark
dqpb
weather
christmas
grenade
point
layer
betaWave
fingerDance
fistBump
soccerHeader
mindblown
speaker
orangePulse
bluePulse
orangeBluePulse
timeTravel
aesthetic
dwarfFortressUse the randomSpinner() function to retrieve a single random spinner object from the collection. The returned object includes the interval and frames properties.
import {randomSpinner} from 'cli-spinners';
console.log(randomSpinner());
/*
{
interval: 80,
frames: ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏']
}
*/A Spinner object consists of two read-only properties:
interval: The intended time per frame, in milliseconds.frames: An array of strings representing the animation frames.