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

@vysmo/text-react

v0.2.0

Published

React bindings for @vysmo/text — an <AnimateText> component that drives splitText + animateText with declarative props (preset, split, stagger, repeat, etc.) and a hook for advanced cases.

Downloads

256

Readme

@vysmo/text-react

React bindings for @vysmo/text. One <AnimateText> component, one hook (useAnimateText), 243 presets out of the box.

Live preset browser + Studio · Source

Install

pnpm add @vysmo/text @vysmo/text-react

react ≥ 18 is a peer dependency.

Quick start

import { AnimateText } from "@vysmo/text-react";

export function Hero() {
  return (
    <AnimateText as="h1" preset="enter/fade-up">
      Hello world
    </AnimateText>
  );
}

The component renders a single element (<span> by default; override via as), and on mount runs animateText against it with the props you've passed. Cleanup happens automatically on unmount.

Tree-shake the catalog

Pass a preset object instead of a name and only that preset ships in your bundle:

import { AnimateText } from "@vysmo/text-react";
import { fadeUp } from "@vysmo/text";

<AnimateText as="h1" preset={fadeUp}>
  Hello world
</AnimateText>

The string-name path pulls in the whole 243-preset registry; the object path is byte-for-byte just the preset you imported.

Custom choreography

Skip the preset and pass animations directly:

<AnimateText
  as="h1"
  split="character"
  stagger={28}
  animations={[
    { prop: "opacity", from: 0, to: 1, duration: 600, ease: "expo.out" },
    { prop: "translateY", from: 24, to: 0, duration: 800, ease: "back.out" },
  ]}
>
  Hand-rolled
</AnimateText>

Props

| Prop | Type | Default | Notes | |---|---|---|---| | as | ElementType | "span" | Tag name for the wrapper element. Pass "h1", "p", etc. for semantic markup. | | children | ReactNode | — | The text content. Strings are simplest; reference changes re-run the animation. | | preset | PresetName \| Preset | — | Preset name (string) or imported preset object (tree-shakable). | | split | "character" \| "word" \| "line" | preset's split, or "character" | Split granularity. | | stagger | number | 30 | Milliseconds between consecutive slices starting. | | staggerOrder | StaggerOrder | "start" | Order in which slices receive their offset. | | animations | TextAnimationSpec[] | — | Custom specs (used when no preset or to override). | | perspective | number | — | Container perspective in px. Required for visible 3D transforms. | | perspectiveOrigin | string | — | Container perspective-origin. | | transformOrigin | TransformOrigin | — | Origin applied to every slice. | | autoPlay | boolean | true | Begin playing automatically on mount. | | delay | number | — | Ms before the first play begins. | | repeat | number \| "infinite" | 1 | How many cycles. | | repeatDelay | number | 0 | Delay between cycles when repeat > 1. | | onComplete | () => void | — | Fires when the choreography finishes naturally (won't fire while looping). | | className | string | — | Forwarded to the wrapper element. | | style | CSSProperties | — | Forwarded to the wrapper element. |

Replay on the same props

Re-run an animation that's already played using a key prop:

<AnimateText key={replayCount} preset="emphasis/pulse">
  Important
</AnimateText>

Bumping the key fully remounts the component, so the animation runs again.

Hook (advanced)

When you can't wrap the JSX (Markdown-rendered headings, MDX, third-party components), animate an external ref:

import { useRef } from "react";
import { useAnimateText } from "@vysmo/text-react";

function MyHeading({ children }) {
  const ref = useRef<HTMLHeadingElement>(null);
  useAnimateText(ref, { preset: "enter/fade-up" });
  return <h1 ref={ref}>{children}</h1>;
}

SSR

The wrapper is SSR-safe: useEffect bodies don't run on the server, and the module body itself doesn't touch window / document. Server renders the wrapping element with its raw text; client mounts the animation.

License

MIT.