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

block-text-reveal

v0.1.2

Published

animated text reveal for react

Readme

block-text-reveal

A small, typed React text-reveal component powered by Framer Motion. It is designed to work directly in Next.js, including the App Router, with no Tailwind or CSS setup required.

Install

npm install block-text-reveal framer-motion

React and React DOM are peer dependencies, so they should already be installed in a React or Next.js project.

Basic usage

The simplest API is to import the component and wrap plain text with it:

import { TextReveal } from "block-text-reveal";

export default function Page() {
  return (
    <TextReveal split="word" blockColor="#6366f1">
      Hello, motion.
    </TextReveal>
  );
}

The component includes its own "use client" directive. In the Next.js App Router, the page above can remain a server component. If you want to replay the animation from a button or another piece of state, put that interactive wrapper in a client component and change replayKey:

"use client";

import { useState } from "react";
import { TextReveal } from "block-text-reveal";

export function AnimatedHeading() {
  const [replayKey, setReplayKey] = useState(0);

  return (
    <>
      <TextReveal
        split="word"
        direction="bottom-to-top"
        stagger={0.1}
        style={{ fontSize: "4rem", fontWeight: 800 }}
        replayKey={replayKey}
      >
        Build things that move.
      </TextReveal>

      <button onClick={() => setReplayKey((key) => key + 1)}>Replay</button>
    </>
  );
}

The text prop is also supported when children are inconvenient:

<TextReveal text="NEXT.JS + MOTION" split="char" />

Nested JSX is also supported. The markup and its attributes are preserved while the text inside it is split and animated. A single root element, such as this heading, becomes the reveal container so its semantics remain intact:

<TextReveal split="word">
  <h1 className="text-5xl text-shadow-lg text-shadow-white/30">
    (<span className="font-mono">404</span>)
  </h1>
</TextReveal>

Props

| Prop | Type | Default | Description | | ---------------- | -------------------------------------------------------------------------- | ------------------------------------------ | ---------------------------------------------------------------- | | children | ReactNode | — | Plain text to reveal. This is the recommended API. | | text | string | — | Alternative to children; children wins if both are provided. | | split | "full" \| "word" \| "char" \| "line" | "full" | Unit used for staggering. | | direction | "left-to-right" \| "right-to-left" \| "top-to-bottom" \| "bottom-to-top" | "left-to-right" | Direction of the coloured wipe. | | stagger | number | 0.08 | Delay in seconds between split units. | | duration | number | 0.55 | Wipe duration in seconds. | | textOffset | number | 8 | Initial vertical offset of the text entrance in pixels. | | spring | TextRevealSpring | { stiffness: 140, damping: 14, mass: 1 } | Framer Motion spring settings. | | blockColor | string | "#6366f1" | Wipe rectangle colour. | | textColor | string | "currentColor" | Text colour. | | textClassName | string | — | Class for each animated text span. | | blockClassName | string | — | Class for each wipe span. | | textStyle | CSSProperties | — | Inline style for each text span. | | blockStyle | CSSProperties | — | Inline style for each wipe span. | | replayKey | string \| number | — | Change this value to replay the same animation. |

All normal span attributes, including className, style, aria-*, and event handlers, are forwarded to the outer wrapper.

Modes

  • full: one reveal block over the entire string.
  • word: reveals words in sequence while preserving whitespace.
  • char: reveals Unicode code points in sequence.
  • line: reveals each newline-delimited line in sequence.

The package intentionally does not require Tailwind. Use className or style for typography and layout:

<TextReveal
  split="line"
  className="font-display text-6xl tracking-tight"
  blockColor="black"
>
  Crafting interfaces{`\n`}with precision.
</TextReveal>

Nested markup inside children is preserved. When there is one root element, it becomes the reveal container; otherwise, the content is rendered inside the component's normal outer span.