1.0.13 • Published 2 years ago

live-typer v1.0.13

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

live-typer

An animated way to display your text in a typing kind of style

Made with create-react-library

NPM JavaScript Style Guide

Alt Text

Install

npm install --save live-typer

Usage

import React, { useState } from 'react'
import { Typography } from '@material-ui/core'
import LiveTyper from 'live-typer'

const AnimatedComponent = () => {
  const strings = [
    "Hello world",
    "Greetings friend",
  ]
  const [text, setText] = useState(strings[0])

  return <div>
    <LiveTyper
        text={text}
        options={{
          typeDelay: 50,
          backspaceDelay: 15,
          cursor: true,
          cursorBlinkSpeed: 250,
          cursorOpacity: 0.5,
        }}
        wrapper={Typography}
        // any props you want to use with the wrapper component specified above
        variant='h4'
        style={{
          //...
        }}/>
    <button
      onSelect={() =>
        setText((currentText) =>
          currentText === strings[0]
            ? strings[1]
            : strings[0])}>
    </button>
  </div>
}

// Alternatively, wrap the component along with not passing anything into the wrapper prop.
// This will return a span that wraps a span wrapped `text` and conditionally a span wrapped cursor `'|'`
const AnimatedComponent = () => {
  //...
  return <div>
    <Typography
      variant='h4'
      style={{
        //...
      }}/>
      <LiveTyper
        text={text}
        options={{
          typeDelay: 50,
          backspaceDelay: 15,
          cursor: true,
          cursorBlinkSpeed: 250,
          cursorOpacity: 0.5,
        }}/>
    </Typography>
    //...
  </div>
}

License

MIT © GeorgeNav

1.0.13

2 years ago

1.0.12

2 years ago

1.0.11

3 years ago

1.0.10

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago