Socket
Socket
Sign inDemoInstall

react-typewriter-effect

Package Overview
Dependencies
328
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    react-typewriter-effect

creating a typewriter effect using react


Version published
Weekly downloads
1K
decreased by-1.13%
Maintainers
1
Install size
19.6 MB
Created
Weekly downloads
 

Readme

Source

React-typewriter-effect

A package that gives your text a typing effect

Use case scenario

Description

This package lets you create a typewriting effect for text elements

Typewriter description

  • Typewriter Effect animates when component is in view. By default it uses the document reference to check if component is in view or not. But you can pass the ref object which is scrollable to the scollArea props.

For example

const myRef = document.querySelector('.scrollable-div')

<TypeWriterEffect width="230" trackWidth="13" percentage={score} scrollArea={myRef} />

Otherwise if scrollArea is not defined, document reference object is used.

Set up

To use package, Start by installing package

  • npm i react-typewriter-effect

on your react project file

For a single text display

import TypeWriterEffect from 'react-typewriter-effect';

 <TypeWriterEffect
            textStyle={{ fontFamily: 'Red Hat Display' }}
            startDelay={100}
            cursorColor="black"
            text="This is a single text"
            typeSpeed={100}
            scrollArea={myAppRef}
          />

Output

single text display

For a multiiple text display

Set the muultiText props to an array of strings which are displayed sequentially

import TypeWriterEffect from 'react-typewriter-effect';

     <TypeWriterEffect
        textStyle={{
          fontFamily: 'Red Hat Display',
          color: '#3F3D56',
          fontWeight: 500,
          fontSize: '1.5em',
        }}
        startDelay={2000}
        cursorColor="#3F3D56"
        multiText={[
          'Hey there, This is a type writer animation package',
          'it consist of two types...',
          'Single text display and multi text display',
          'Fonts can be customized.',
          'The type speed can be customized as well',
        ]}
        multiTextDelay={1000}
        typeSpeed={30}
      />
Output

Rect bar

Properties and description

  • text (must be a string): Required in sigle text display mode. The text in string.

  • multiText (array of string): Required in multi text mode

  • multiTextDelay (must be a number): delay before each text is erased in multi text display in milli seconds.

  • typeSpeed (must be a number): Speed of typing in milli seconds,

  • startDelay (must be a number): Delay before animation starts in milli seconds

  • hideCursorAfterText (a boolean): it removes cursor after typing.

  • cursorColor (must be a string): color of the cursor

  • textStyle (must be an object): custom css styles can be applied to the text in this object.

  • scrollArea (must be a dom element): the scrollable area. By default it is document

FAQs

Last updated on 28 Jul 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc