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-mk

v1.1.6

Published

A light weight React component for emulating keyboard typing.

Downloads

103

Readme

A light weight React component for emulating typing animations.

Install

npm i react-mk --save

No need to import pesky CSS files, react-mk works right out of the box.

Example

Test it out on codesandbox

Instructions

  • Import Keyboard from react-mk

  • Keyboard accepts any child with a valid toString method

  • Keyboard exposes a type method when children is a type of function

  • Keyboard will type out your text in an organic manner, see example

  • Besides children, Keyboard can take the following optional props

    • sentenceDelayPerCharRange: an array of two numbers indicating the delay in milliseconds which react-mk applies between words, the delay is calculated by getting a random number in your range and multiplying it by the number of characters in your sentence.
    • keyPressDelayRange: an array of two numbers indicating the delay in milliseconds which react-mk applies between characters, the delay is calculated by getting a random number in your range.
  • You may also import the Cursor component from react-mk; a standard blinking cursor that accepts the following props

    • children: the cursor you wish to display, it will accept any node and is a | by default
    • blink: a bool which is true by default, when false the cursor will not blink
    • blinkAnimationDuration: the animation-duration of the css animation property of the cursor
    • All other props will be spread to the root element which is a span

Usage

import React from 'react';
import Keyboard, { Cursor } from 'react-mk';

const TypingComponent = () => (
  <>
    <Keyboard sentenceDelayPerCharRange={[0, 0]}>You can write whatever you like here</Keyboard>
    <Cursor />
    <br />
    <Keyboard keyPressDelayRange={[200, 400]}>
      {({ type }) =>
        type(
          1000,
          'You can even type super slowly using the keyPressDelayRange prop',
          300,
          'Set the blink property of Cursor to false to disable the blinking animation --> ',
        )
      }
    </Keyboard>
    <Cursor blink={false} />
    <br />
    <Keyboard sentenceDelayPerCharRange={[0, 0]} keyPressDelayRange={[50, 70]}>
      {({ type }) => type(3000, 'Multiple instances of Keyboard can easily be rendered at the same time')}
    </Keyboard>
    <Cursor>#</Cursor>
    <br />
    <Keyboard sentenceDelayPerCharRange={[300, 400]}>
      {({ type }) =>
        type(
          4000,
          "Use the sentenceDelayPerCharRange prop to adjust the amount of time that your sentences should be visible (It'll be a while before the next sentence appears)",
          'You can also pass a number to the `type` function to dictate the time between deleting the previous sentence and writing the next sentence',
        )
      }
    </Keyboard>
    <Cursor blinkAnimationDuration={200}>[]</Cursor>
  </>
);