logf-spinner
v1.2.3
Published
Simple, composable, animated terminal spinner
Downloads
7
Maintainers
Readme
LogF-Spinner ·
Simple terminal spinner. Usable standalone or with other log-frame components.
Install
npm install logf-spinner
Usage
const { LogFrame } = require('log-frame');
const { Spinner } = require('logf-spinner');
// create, configure, and start spinner
const spinner = new Spinner('dots');
spinner.text = 'loading';
spinner.color = 'cyan';
spinner.start();
// attach to frame for display
const frame = new LogFrame();
frame.view = spinner;
API
new Spinner('theme')
theme
The name of a spinner theme from cli-spinners. Some examples:
Or a custom theme object:
new Spinner({
frames: ['-', '|'],
interval: 40, // optional, default is 20
});
Methods
.start()
Start spinning.
.stop()
Stop spinning.
Properties
.text
(string)
Optional text to display next to the spinner.
.color
(string)
Optional color tint to apply to the spinner.