cli-spinners

repository·main·Indexed 25 days ago

https://github.com/sindresorhus/cli-spinners

A 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.

Tokens
1K
Snippets
6
Records
7
Agent score
84%

What's inside cli-spinners

  1. Access specific spinners via cliSpinners

    main

    Import 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: ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏']
    }
    */
  2. Import the spinners data object

    main

    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'};
  3. Access individual spinners via the cliSpinners object

    main

    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: ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'] 
    // }
  4. Reference available SpinnerName values

    main

    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
    dwarfFortress
  5. Get a random spinner with randomSpinner()

    main

    Use 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: ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏']
    }
    */