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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@tlberglund/handwriting-react

v0.2.1

Published

React component for handwriting animation

Readme

handwriting-react

React component wrapping HandwritingAnimator from handwriting-playback. Animates handwritten text on a canvas, playing when the element scrolls into view.

Installation

# From the repo root (local path dependency)
npm install ../handwriting-react

Add peer dependencies if not already present:

npm install react react-dom

Basic Usage

import { Handwriting } from 'handwriting-react';

// Fetch your glyph set once (e.g. from your API)
const glyphSet = await fetch('/api/glyphsets/my-set/export').then(r => r.json());

function Hero() {
  return (
    <Handwriting
      glyphSet={glyphSet}
      text="Hello, world"
      style={{ width: 600, height: 130 }}
    />
  );
}

The component does not fetch data. Load the GlyphSet yourself and pass it as a prop.

Data-Fetching Pattern

import { useState, useEffect } from 'react';
import { Handwriting } from 'handwriting-react';
import type { GlyphSet } from 'handwriting-playback';

function AnimatedHeading({ text }: { text: string }) {
  const [glyphSet, setGlyphSet] = useState<GlyphSet | null>(null);

  useEffect(() => {
    fetch('/api/glyphsets/my-set/export')
      .then(r => r.json())
      .then(setGlyphSet);
  }, []);

  if (!glyphSet) return null;

  return (
    <Handwriting
      glyphSet={glyphSet}
      text={text}
      style={{ width: 500, height: 120 }}
    />
  );
}

Sizing

You must set width and height on the component. The canvas fills its wrapper <div>, which receives your className and style. If the canvas has zero dimensions when animation triggers, a console warning is logged and no animation runs.

// Via style
<Handwriting style={{ width: 400, height: 100 }} ... />

// Via className (Tailwind example)
<Handwriting className="w-96 h-24" ... />

playOn Prop

| Value | Behavior | |-------|----------| | "visible" (default) | Plays once when the canvas first scrolls into view (IntersectionObserver). Falls back to mount if IntersectionObserver is unavailable. | | "mount" | Plays immediately in a useEffect on mount. |

<Handwriting playOn="mount" glyphSet={glyphSet} text="Hi" style={{ width: 300, height: 80 }} />

Imperative Ref

Use a ref to replay the animation programmatically:

import { useRef } from 'react';
import { Handwriting } from 'handwriting-react';
import type { HandwritingHandle } from 'handwriting-react';

function Demo() {
  const ref = useRef<HandwritingHandle>(null);

  return (
    <>
      <Handwriting
        ref={ref}
        glyphSet={glyphSet}
        text="Replay me"
        style={{ width: 400, height: 100 }}
      />
      <button onClick={() => ref.current?.play()}>Replay</button>
    </>
  );
}

Props

| Prop | Type | Default | Description | |------|------|---------|-------------| | glyphSet | GlyphSet | required | Pre-loaded glyph set from the export endpoint | | text | string | required | Text to animate | | speed | number | 1.5 | Speed multiplier | | color | string | '#1a1a1a' | Stroke color | | capHeight | number | 80 | Cap-height in CSS pixels | | topPad | number | 12 | Top padding in CSS pixels | | minWidth | number | 2 | Minimum stroke width in px | | maxWidth | number | 4 | Maximum stroke width in px | | letterGap | number | 0.05 | Gap between letters in cap-height units | | wordGap | number | 0.35 | Gap between words in cap-height units | | playOn | 'visible' \| 'mount' | 'visible' | When to trigger animation | | onComplete | () => void | — | Called when animation finishes | | className | string | — | Applied to wrapper div | | style | CSSProperties | — | Applied to wrapper div |