Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/tanmaylaud/react-typewriting-effect

The simplest typewriter effect component in React. ( Requires react >=16.8.0 )
https://github.com/tanmaylaud/react-typewriting-effect

Last synced: about 5 hours ago
JSON representation

The simplest typewriter effect component in React. ( Requires react >=16.8.0 )

Awesome Lists containing this project

README

        

# react-typewriting-effect

> The simplest typewriter effect component in React. ( Requires react >=16.8.0 )

[![NPM](https://img.shields.io/npm/v/react-typewriting-effect.svg)](https://www.npmjs.com/package/react-typewriting-effect) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)

![](preview.gif)

## Updates in v1.0.4

- cursor option to add custom cursor text
- cursor css can be customised using cursorClassName

## Install

```bash
npm install --save react-typewriting-effect
```

## Usage

```tsx
import React from 'react'

import { Typewriter } from 'react-typewriting-effect'
import 'react-typewriting-effect/dist/index.css'

const App = () => {
return
}

export default App
```

```tsx
import React from 'react'

import { Typewriter } from 'react-typewriting-effect'
import 'react-typewriting-effect/dist/index.css'

const App = () => {
return (

)
}

export default App
```

```tsx
import React from 'react'

import { Typewriter } from 'react-typewriting-effect'
import 'react-typewriting-effect/dist/index.css'

const App = () => {
return (

)
}

export default App
```

You can view demo [here](https://tanmaylaud.github.io/react-typewriting-effect/)

## Options

| Name | Type | Default value | Description |
| ----------------------- | --------------- | ------------- | --------------------------------------------------- |
| string | String | | String to type out |
| delay (speed in v1.0.3) | number | 100 | The delay between each key when typing. |
| onComplete | Lambda/Function | () => {} | Function to execute when string is completely typed |
| stopBlinkinOnComplete | Boolean | false | Whether to blink cursor after string is typed |
| className | String | '' | Field to set classes for the HTML Element |
| cursor | String | ' | ' | Cursor string |
| cursorClassName | String | undefined | Field to set classes for the cursor |

## License

MIT © [tanmaylaud](https://github.com/tanmaylaud)