use-typing

1.0.4 • Public • Published

npm version

useTyping

Simulate typing with React hooks.

Table of Contents

Getting started

npm install --save use-typing

Usage

import { useTyping } from 'use-typing'
const PHRASES = ['I regret nothing.', 'Never listen to Pierce.', 'Cool cool cool.', 'Six seasons and a movie!']

// Passing only phrases
const text = useTyping({ phrases: PHRASES })

// Do not loop (default to true)
const text = useTyping({ phrases: PHRASES, loop: false })

// Controlling speed of typing (default to 100ms)
const text = useTyping({ phrases: PHRASES, speed: 50 })

// Pausing after a phrase (default to 2000ms)
const text = useTyping({ phrases: PHRASES, pause: 1000 })

// Setting all props
const text = useTyping({ phrases: PHRASES, loop: false, speed: 50, pause: 1000 })

Full example can be found here

Demo

git clone git@github.com:jagonzalr/useTyping.git
cd useTyping
npm intall
npm start

License

useTyping is MIT licensed.

Readme

Keywords

Package Sidebar

Install

npm i use-typing

Weekly Downloads

2

Version

1.0.4

License

ISC

Unpacked Size

14.7 kB

Total Files

4

Last publish

Collaborators

  • jagonzalr