Animated command line loading indicator using Unicode braille patterns (based on Heroku CLI).
| size | rotation | preview | sample code |
|---|---|---|---|
| large | cw |
|
examples/formatted.js |
| small | ccw |
|
examples/formatted-multicolor.js |
- Use
start()andstop()to enable or disable the loading indicator. - Optionally specify
rotationascw(clockwise) orccw(counterclockwise) - Optionally provide a custom
formatfunction to add text or colors for the loading indicator.
// ESM
import LoadingIndicator from "@edisoncks/cli-loading-indicator";
// CommonJS
const LoadingIndicator = require("@edisoncks/cli-loading-indicator").default;
const loader = new LoadingIndicator({
size: "large",
rotation: "cw",
format: (pattern) => `charging plasma cannon ${pattern}`,
});
// Display loading indicator for 5 seconds, and then stop.
loader.start();
setTimeout(() => {
loader.stop();
}, 5000);This library uses ANSI escape sequences for cursor control and animation. Supported terminals include:
- Linux — gnome-terminal, konsole, xterm, Alacritty, Kitty, WezTerm
- macOS — terminal.app, iTerm2, Alacritty, Kitty
- Windows — Windows Terminal
Limited or no support:
- Legacy Windows Console — cmd.exe, PowerShell (before Windows 10 1903).
DEC private modes (
?25l/h) were not supported in older environments.
Heavily inspired by heroku cli loading indicator

