npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-natural-typing-effect

v2.0.0

Published

A simple React component library made to display a string's characters as Span elements within a Div element using a natural-feeling typing animation that is configurable and internationalized.

Downloads

66

Readme

React-Natural-Typing-Effect

About

This is a simple and small React/Typescript component library for displaying a string's characters as Span elements within a Div element using a configurable and natural-feeling typing animation, pause, and decomposition of decomposeable unicode characters. Decomposition refers to graphemes that are made up of constituent, mappable components within unicode. For example, in this component library a Korean string appears to be typed as first and then the is added to make the final . This can simulate a more realistic typing effect.

Usage

In your terminal: npm install --save react-natural-typing-effect

In your code:

import Typer from "react-natural-typing-effect";

<Typer text="This text will be typed." />

Props

  • text:

    • Type: string.
    • Required.
    • Default: none.
    • The string to render with a natural typing effect.
  • id:

    • Type: string.
    • Optional.
    • Default: none.
    • The HTML element id attribute for the parent element included with this component.
  • isVisible:

    • Type: boolean.
    • Optional.
    • Default: true.
    • Whether the component is visible or not.
  • customTypingOptions:

    • Type: CustomTypingOptions.
      • { ms: number, pow: number, ... }.
    • Optional and all options are also optional.
    • Default: none.
    • Options:
      • ms
        • Type: number.
        • Optional.
        • Default: 20.
        • Milliseconds.
      • pow
        • Type: number.
        • Optional.
        • Default: 2.
        • The exponent to skew to shorter (greater exponent) or longer (smaller exponent) intervals.
      • mode
        • Type: string.
        • Optional.
        • Default: typewriter.
        • Built in modes are:
          • typewriter black text, white background, black typing head (default).
          • negativeTypewriter white text, black background, white typing head.
          • blackGreenTerminal green text, black background, solid green cursor at end of line.
      • cursorAtEndOfLine
        • Type: boolean.
        • Optional.
        • Default: false unless the built-in mode blackGreenTerminal is used.
        • Adds a cursor-like Span element at the end of the text.
        • Note: if set to true and mode blackGreenTerminal is not used then an unused CSS class name called react-natural-typing-effect-cursor is added to the cursor Span element.
      • blinkingCursor
        • Type: boolean.
        • Optional.
        • Default: false.
        • Adds a blinking effect to the cursor. Only works if cursorAtEndOfLine is also true.
      • isRepeated
        • Type: { isRepeated: boolean, ...}
        • Optional.
        • Default: none.
        • Specifies options for repeating the typed text. Text is not repeated if this option is unspecified.
        • Options:
          • isRepeated
            • Type: boolean.
            • Required.
            • Default: none.
            • true means the text is typed more than one time in an over-written manner (i.e., the text is erased and re-typed on each repeat). false is the same as leaving the optional parent parameter isRepeated unspecified: text is not repeated.
          • count
            • Type: number.
            • Required.
            • Default: none.
            • The number of times to repeat the typing of the text.
          • isInfinite
            • Type: boolean.
            • Required.
            • Default: none.
            • true means the text will be typed repeatedly without end (i.e., it is theoretically the same as assigning count to an infinite value). false means that the text won't be typed repeatedly infinitely.
          • msPauseBetweenRepeats
            • Type: number.
            • Required.
            • Default: none.
            • This is how long the component will wait once the text has been completely typed before erasing the text and starting over.
  • language

Gif of it working (v2.0.0)

I made a JS Fiddle to try out some different methods of splitting the strings and decomposing the unicode characters: https://jsfiddle.net/j3pydev/635x09d4/. In it I used some translations of the English sentence "My name is JS Fiddle. What is your name?" that I grabbed from DuckDuckGo's search engine. I have no idea of the accuracy of these translations, although the Japanese and Koreans ones look correct enough to me. Note that the Arabic example makes use the CSS rule direction:'rtl' outside of this component library: screenshot gif of version 2.0.0 of React-Natural-Typing-Effect npm module components