1.0.4 • Published 7 months ago

react-dynamic-typewriter v1.0.4

Weekly downloads
-
License
-
Repository
-
Last release
7 months ago

React Dynamic TypeWriter

A lightweight and customizable React component that creates a typewriter effect for your text content.

npm version npm downloads

Installation

npm install react-dynamic-typewriter

or

yarn add react-dynamic-typewriter

Demo

Demo

Basic Typewriter Animation

Basic typing animation with deletion

Single Text Support

Support for multiple lines of text

Dynamic Content Updates

Dynamic content updating in real-time

Features

  • Smooth typing animation
  • Support for multiple text strings
  • Customizable typing and deletion speeds
  • Support for multiline text
  • Blinking cursor effect
  • Configurable delays and wait times
  • Memoized rendering for optimal performance

Usage

import TypeWriter from 'react-dynamic-typewriter';

// Basic usage
function Example() {
  const content = [
    "Hello World!",
    "This is a typing animation...",
    "Pretty cool, right?"
  ];

  return (
    <TypeWriter
      content={content}
      writeSpeed={100}
      deleteSpeed={50}
      waitTime={2000}
    />
  );
}

// Static content (no deletion)
function StaticExample() {
  const content = [
    "This text will be typed out and remain static."
  ];

  return (
    <TypeWriter
      content={content}
      writeSpeed={100}
    />
  );
}

Props

PropTypeDefaultDescription
contentstring[][]Array of strings to be typed
writeSpeednumber1000Time in milliseconds between typing each character
deleteSpeednumber200Time in milliseconds between deleting each character
waitTimenumber4000Time in milliseconds to wait before deleting text
delaynumber200Delay between deletion and start of next text
delayToStartnumber0Initial delay before starting the animation

Examples

Multiple Lines

const content = [
  "This is line one\nThis is line two",
  "Multiple lines are supported!"
];

<TypeWriter
  content={content}
  writeSpeed={100}
  deleteSpeed={50}
  waitTime={2000}
/>

Dynamic Content with State

function DynamicContent() {
  const [messages, setMessages] = useState(['Initial message']);

  return (
    <TypeWriter
      content={messages}
      writeSpeed={100}
      deleteSpeed={50}
      waitTime={2000}
    />
  );
}

Browser Support

  • Chrome
  • Firefox
  • Safari
  • Edge
  • Opera

License

MIT

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

1.0.4

7 months ago

1.0.3

7 months ago

1.0.2

7 months ago

1.0.1

7 months ago

1.0.0

7 months ago