ora
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|---|---|---|---|---|
chalk | 5.3.0 | 13.08 kB | MIT | prod | |
cli-cursor | 4.0.0 | 2.06 kB | MIT | prod | |
cli-spinners | 2.9.2 | 6.44 kB | MIT | prod | |
is-interactive | 2.0.0 | 2.33 kB | MIT | prod | |
is-unicode-supported | 1.3.0 | 1.93 kB | MIT | prod | |
log-symbols | 5.1.0 | 2.2 kB | MIT | prod | |
stdin-discarder | 0.1.0 | 2.35 kB | MIT | prod | |
string-width | 6.1.0 | 2.36 kB | MIT | prod | |
strip-ansi | 7.1.0 | 2.12 kB | MIT | prod |
Ora is a powerful npm package designed to create elegant terminal spinners in JavaScript. When running long processes or tasks, these terminal spinners serve as a visual cue on the console, enhancing the user-friendliness and interactivity of any application. The spinners created by Ora are customizable, allowing developers to configure properties such as text, spinner style, color, interval between frames, stream output, and more.
To use the Ora npm package, you'll first need to install it in your project using npm. The command for installation is npm install ora
. Once installed, you can import the Ora package into your JavaScript code and start using it to create custom terminal spinners. Here's a basic usage example:
import ora from 'ora';
// Create a spinner and start it
const spinner = ora('Loading unicorns').start();
// Change spinner properties after a certain time
setTimeout(() => {
spinner.color = 'yellow';
spinner.text = 'Loading rainbows';
}, 1000);
In this example, we start with a spinner that displays the text "Loading unicorns". After a second, we change its color to 'yellow' and modify the displayed text to 'Loading rainbows'. We can also control the spinner's state with commands like spinner.start()
, spinner.stop()
, spinner.succeed()
and spinner.fail()
to provide interactive feedback during task execution.
The official documentation for the Ora package can be found in its GitHub repository at https://github.com/sindresorhus/ora
. The documentation provides a full description of the package's API, detailing the configuration options available to customize the spinner and methods to control its behavior. Examples for various use cases, technical details about the package's implementation, and Frequently Asked Questions (FAQs) can also be found in the repository. Developers can refer to this documentation to learn in-depth about incorporating Ora's terminal spinners into their applications, troubleshooting issues, contributing to the package's development, and more.