Rolling Text

Letters roll over themselves like a split-flap board.

rolling-text.tsx

Installation

1

Install the packages

npm install @prequelui/react motion

@prequelui/react reuses the primitive library your components already depend on.

2

Add the component

npx shadcn@latest add https://animate.prequelui.terravidhal.me/r/rolling-text.json

npx shadcn@latest add https://animate.prequelui.terravidhal.me/r/rolling-text.json

3

Turn on the motion

npx @prequelui/cli@latest animate rolling-text

The CLI finds the component through components.json, swaps the import and removes the CSS animation classes that Motion replaces.

Usage

Import the component and compose it exactly like the primitive it wraps. Motion is enabled by default; the tempo prop scales every duration and softens every spring.

rolling-text.tsx
import { RollingText } from "@/components/prequelui/rolling-text";

export default function Demo() {
  return (
    <RollingText
      text="MOVE WITH PURPOSE"
      className="text-4xl font-semibold tracking-[0.06em]"
    />
  );
}
import { RollingText } from "@/components/prequelui/rolling-text";

export function Variant() {
  return (
    <RollingText tempo={1.2}>
      …
    </RollingText>
  );
}

Animation

Every character is a split-flap. The front face rotates away from its top edge while the back face falls into place from its bottom edge, character by character with a tenth of a second between them.

  • Character tween: 500 ms ease-out with a 100 ms step.
  • The back face starts 300 ms after its front face.
  • Perspective is pushed very far to keep the glyphs the same size.
  • The full string is exposed to assistive technology as one label.
500 ms ease-outstep 100 msback +300 msrotateX 90°

API Reference

Each part accepts the usual HTML props in addition to the motion props below. No accessibility prop is hidden behind the animation layer.

RollingText

PropTypeDefault
textstring—
delaynumber0
inViewbooleanfalse
inViewOncebooleantrue
transitionTransitioncomponent spring or tween

Built by Vidhal. The source is available on GitHub.

Last updated: 11/17/2026