windups

A unique typewriter effect library for React.

README

windups




A unique typewriter (or, ahem, "windup") effect library for React.

This effect can be applied to strings _or pretty anything you can put in React's children prop_.

What's it look like?


For strings:

  1. ``` js
  2. import { useWindup } from "windups";

  3. function MyWindup() {
  4.   const [text] = useWindup(
  5.     "This string will be rendered character by character!"
  6.   );

  7.   return <div>{text}</div>;
  8. }
  9. ```

For pretty much everything else:

  1. ``` js
  2. import { WindupChildren } from "windups";

  3. function MyWindup() {
  4.   return (
  5.     <WindupChildren>
  6.       {"It's fun to do"}
  7.       <em>{"wild"}</em>
  8.       {"stuff with text!"}
  9.     </WindupChildren>
  10.   );
  11. }
  12. ```

There are additional APIs for:

- Controlling the pacing of the text!
- Adding pauses!
- Firing effects (e.g. when each character is typed, or at arbitrary points)!
- Ahead of render-time line-breaking!


Want to see a codebase that makes extensive, real-word use of this package? Source for the docs site is at https://github.com/sgwilym/windups-docs