# react-code-auto-typing

> Automatic code writing animation with highlighting included

Latest version **1.0.5** (published 2021-08-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-code-auto-typing
pnpm add react-code-auto-typing
yarn add react-code-auto-typing
bun add react-code-auto-typing
```

## 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.5 |
| Published | 2021-08-19 |
| First published | 2021-08-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 19.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 6 |
| Author | Cristian Azócar |
| Maintainers | cristian-azocar |
| Keywords | react, highlighting, typing, auto typing |

## Links

- npm: https://www.npmjs.com/package/react-code-auto-typing
- Repository: https://github.com/cristian-azocar/react-code-auto-typing
- Homepage: https://github.com/cristian-azocar/react-code-auto-typing#readme
- Issues: https://github.com/cristian-azocar/react-code-auto-typing/issues
- npm.io page: https://npm.io/package/react-code-auto-typing

## Dependencies (2)

- [react-typist](https://npm.io/package/react-typist.md) ^2.0.5
- [react-syntax-highlighter](https://npm.io/package/react-syntax-highlighter.md) ^15.4.4

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.0.5 (latest) — 2021-08-19
- 1.0.4 — 2021-08-19
- 1.0.3 — 2021-08-18
- 1.0.2 — 2021-08-18
- 1.0.1 — 2021-08-18
- 1.0.0 — 2021-08-18

## README

# React Code Auto Typing

**React Code Auto Typing** is a React component for automatic code writing animation with highlighting included. Under the hood it uses [react-typist](https://github.com/jstejada/react-typist) and [react-syntax-highlighter](https://github.com/react-syntax-highlighter/react-syntax-highlighter).

Check out a working demo [here](https://codesandbox.io/s/react-code-auto-typing-demo-t7kps).

## Install

```
npm install --save react-code-auto-typing
```

## Usage

```jsx
import CodeAutoTyping from "react-code-auto-typing";

const snippet = `function greet(name) {
  return 'Hello ' + name;
}

console.log(greet('John'));`;

export default function Example() {
  return (
    <CodeAutoTyping language="javascript">
      {snippet}
    </CodeAutoTyping>
  );
}
```

**Note**: you can use `\n` and `\t` to give format to the code if you prefer.

## Style

To give a specific style to the highlighting, import one of the provided by the `react-syntax-highlighter` library.

```jsx
import CodeAutoTyping from "react-code-auto-typing";
import { ocean } from "react-syntax-highlighter/dist/esm/styles/hljs";

const snippet = "console.log('Hello World');";

export default function Example() {
  return (
    <CodeAutoTyping
      language="javascript"
      syntaxHighlighterProps={{ style: ocean }}
    >
      {snippet}
    </CodeAutoTyping>
  );
}
```

## Props

This component is basically a wrapper for `react-typist` and `react-syntax-highlighter`, so all props are forwarded to the corresponding library component.

| Prop name              | Type                     | Description                                        |
| ---------------------- | ------------------------ | -------------------------------------------------- |
| children               | `string`                 | The code to highlight and animate                  |
| language               | `string`                 | The language of the code                           |
| syntaxHighlighterProps | `SyntaxHighlighterProps` | Props forwarded to the SyntaxHighlighter component |
| spread props           | `TypistProps`            | Props forwarded to the Typist component            |

For more detail on the props of each library, visit the corresponding documentation:

* [Typist props](https://github.com/jstejada/react-typist#typist-props)
* [Syntax Highlighter props](https://github.com/react-syntax-highlighter/react-syntax-highlighter#props)

## License

[MIT](https://mit-license.org/)

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