# react-use-typewriter

> Typewriter effect hook for react

Latest version **1.0.0** (published 2022-09-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-use-typewriter
pnpm add react-use-typewriter
yarn add react-use-typewriter
bun add react-use-typewriter
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2022-09-06 |
| First published | 2020-01-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 7.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Peter Bartels |
| Maintainers | peterbartels |

## Links

- npm: https://www.npmjs.com/package/react-use-typewriter
- Repository: https://github.com/peterbartels/react-use-typewriter
- Homepage: https://github.com/peterbartels/react-use-typewriter#readme
- Issues: https://github.com/peterbartels/react-use-typewriter/issues
- npm.io page: https://npm.io/package/react-use-typewriter

## Recent versions

- 1.0.0 (latest) — 2022-09-06
- 1.0.0-alpha.5 — 2020-02-02
- 1.0.0-alpha.4 — 2020-01-22
- 1.0.0-alpha.3 — 2020-01-20

## README

# React Typewriter effect hook

## Getting Started

  `npm install --save react-use-typewriter`  
  
  Or
  
  `yarn add react-use-typewriter`  
  
## Usage Example

```jsx
import useTypewriter from "react-use-typewriter";

const Example = () => {
  const words = ["react", "typescript", "nodejs"];
  const currentWord = useTypewriter({words});

  return (
    <div>
      {currentWord}
      <span className="cursor">|</span>
    </div>
  );
}
```  
  
## Options

| Name | Type | Default value | Description |
| --- | --- | --- | --- |
| words | Array | null | Required, words for typing |
| typeSpeed | number | 100 | Speed in ms for each letter to type |
| afterTypingDelay | number | 1000 | Delay in ms after typing has finished |
| eraseWords | boolean | true | Whether or not to erase after typing |
| eraseSpeed |number | 50 | Speed in ms for each letter to erase |
| afterErasingDelay | number | 1000 | Delay in ms after erasing has finished |

## CSS for blinking cursor

Blinking cursor is not included but can be implemented easily with CSS:  

```css
@keyframes blink {
  from, to {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
}

.cursor {
  animation: blink 1s linear infinite forwards;
}
```

---
_Source: https://npm.io/package/react-use-typewriter · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
