@vegadev/react-type-writer
TypeScript icon, indicating that this package has built-in type declarations

1.2.3 • Public • Published

react-type-writer

JavaScript Style Guide

This is a super light-weight and easy to use react hook for simulating a typing effect. Unlike many other packages, this doesn't force you to use a component, and just gives you the string, which you can use however you need to.

Install

npm install --save react-type-writer
yarn add react-type-writer

Sample Usage

Different situations and implementation is available in the following sample project. Code Sandbox

Usage

import * as React from "react";

import { useTypeWriter } from "react-type-writer";

const Example = () => {
  const text = useTypeWriter({
    text: [
      "Born To Shine!",
      "Build For Today, Think For The Future!",
      "Vegaris",
    ],
    infiniteLoop: true,
    blinker: "_",
    delay: 3000,
    blinkerDelay: 100,
  });
  return <div>{text}</div>;
};

Props

Props Type Usage Default
text string | string[] Gets a string or an array of strings to write them in the typewriter null
delay number in miliseconds Gets a number in miliseconds and utilize it as the time stays on each completed sentence 1000ms
blinkerDelay number in miliseconds Gets a number in miliseconds and utilize it as the delay time for the blinker to blink 500ms
blinker string Gets a string (usually a character) to show as the blinker |
infiniteLoop boolean To know if to loop over the text or not after end false

License

MIT © ErfanAsadi

Authors

Iman Akrami, Erfan Asadi

Package Sidebar

Install

npm i @vegadev/react-type-writer

Weekly Downloads

5

Version

1.2.3

License

MIT

Unpacked Size

122 kB

Total Files

23

Last publish

Collaborators

  • imanakrami
  • erandow