$ Spinner
animatedinteractive
Animated loading indicators with 9 built-in styles, live text updates, and elapsed time display.
# Preview
spinner demo
⠋ Loading... (0.0s)
⠙ Authenticating... (1.2s)
⠹ Fetching data... (2.4s)
✔ All tasks completed! (3.6s)
Available styles:
⠋ dots ⣾ braille ◜ arc [=== ] bouncingBar
█ pulse ← arrows - line 🌍 earth 🌑 moon
# Usage
example.ts
import { Spinner } from "@vr_patel/tui";
const spinner = new Spinner({ text: "Loading...", style: "dots" });
spinner.start();
// Update text mid-spin
spinner.update("Almost there...");
// Finish with different states
spinner.stop("Done!"); // ✔ green checkmark
spinner.fail("Error!"); // ✖ red cross
spinner.warn("Warning!"); // ⚠ yellow warning
spinner.info("Note:"); // ℹ blue info# API
| Prop | Type | Default | Description |
|---|---|---|---|
| text | string | "Loading..." | Text shown next to the spinner |
| style | string | SpinnerStyle | "dots" | Animation style name or custom frames |
| color | string | fg.cyan | ANSI color for the spinner character |
| successMark | string | ✔ (green) | Symbol shown on stop() |
| failMark | string | ✖ (red) | Symbol shown on fail() |