1.0.4 • Published 4 years ago

react-typewriting-effect v1.0.4

Weekly downloads
68
License
MIT
Repository
github
Last release
4 years ago

react-typewriting-effect

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

NPM JavaScript Style Guide

npm.io

Updates in v1.0.4

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

Install

npm install --save react-typewriting-effect

Usage

import React from 'react'

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

const App = () => {
  return <Typewriter string='This is an example of typewriting 😄' delay={80} />
}

export default App
import React from 'react'

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

const App = () => {
  return (
    <Typewriter
      string='In this example, the cursor will stop blinking after ther string is completely rendered'
      delay={80}
      stopBlinkinOnComplete
    />
  )
}

export default App
import React from 'react'

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

const App = () => {
  return (
    <Typewriter
      string='In this example, the cursor will be _ and speed will be 50'
      delay={50}
      cursor='_'
    />
  )
}

export default App

You can view demo here

Options

NameTypeDefault valueDescription
stringStringString to type out
delay (speed in v1.0.3)number100The delay between each key when typing.
onCompleteLambda/Function() => {}Function to execute when string is completely typed
stopBlinkinOnCompleteBooleanfalseWhether to blink cursor after string is typed
classNameString''Field to set classes for the HTML Element
cursorString''Cursor string
cursorClassNameStringundefinedField to set classes for the cursor

License

MIT © tanmaylaud