2022-01-21 08:28:41 +00:00
# cli-cursor [![Build Status](https://travis-ci.org/sindresorhus/cli-cursor.svg?branch=master)](https://travis-ci.org/sindresorhus/cli-cursor)
> Toggle the CLI cursor
The cursor is [gracefully restored ](https://github.com/sindresorhus/restore-cursor ) if the process exits.
## Install
```
2022-06-08 10:36:39 +00:00
$ npm install cli-cursor
2022-01-21 08:28:41 +00:00
```
## Usage
```js
const cliCursor = require('cli-cursor');
cliCursor.hide();
const unicornsAreAwesome = true;
cliCursor.toggle(unicornsAreAwesome);
```
## API
2022-06-08 10:36:39 +00:00
### .show(stream?)
2022-01-21 08:28:41 +00:00
2022-06-08 10:36:39 +00:00
### .hide(stream?)
2022-01-21 08:28:41 +00:00
2022-06-08 10:36:39 +00:00
### .toggle(force?, stream?)
2022-01-21 08:28:41 +00:00
2022-06-08 10:36:39 +00:00
#### force
Useful for showing or hiding the cursor based on a boolean.
2022-01-21 08:28:41 +00:00
#### stream
2022-06-08 10:36:39 +00:00
Type: `stream.Writable` < br >
2022-01-21 08:28:41 +00:00
Default: `process.stderr`
2022-06-08 10:36:39 +00:00
---
2022-01-21 08:28:41 +00:00
2022-06-08 10:36:39 +00:00
< div align = "center" >
< b >
< a href = "https://tidelift.com/subscription/pkg/npm-cli-cursor?utm_source=npm-cli-cursor&utm_medium=referral&utm_campaign=readme" > Get professional support for this package with a Tidelift subscription< / a >
< / b >
< br >
< sub >
Tidelift helps make open source sustainable for maintainers while giving companies< br > assurances about security, maintenance, and licensing for their dependencies.
< / sub >
< / div >