Rolling Text

Text whose letters roll over one after another, like a flip board.

Rolling Text
"use client"

import * as React from "react"
import { RollingText } from "@animate-ui/react/primitives/texts/rolling"
import { RefreshIcon } from "@hugeicons/core-free-icons"
import { HugeiconsIcon } from "@hugeicons/react"

import { Button } from "@/components/ui/button"

export default function RollingTextDemo({ delay = 0 }: { delay?: number }) {
  const [run, setRun] = React.useState(0)

  return (
    <div className="flex flex-col items-center gap-6">
      <RollingText
        key={`${run}-${delay}`}
        delay={delay}
        className="text-4xl font-semibold"
        text="Rolling Text"
      />
      <Button variant="outline" size="sm" onClick={() => setRun((n) => n + 1)}>
        <HugeiconsIcon icon={RefreshIcon} strokeWidth={2} data-icon="inline-start" />
        Replay
      </Button>
    </div>
  )
}

Installation

npm install @animate-ui/react motion
pnpm add @animate-ui/react motion
yarn add @animate-ui/react motion
bun add @animate-ui/react motion

Usage

import { RollingText } from '@animate-ui/react/primitives/texts/rolling';

export function Title() {
  return <RollingText text="Rolling Text" inView />;
}

Animation

  • Each letter turns over in 3D (rotateX): its front copy rolls away from its upper quarter while the back copy rolls in from its baseline 0.3s later, 0.5s each on an ease-out.
  • Letters start 0.1s apart (the delay of transition). Words never break in the middle; emoji and accented letters stay whole.
  • Once rolled, the text stays rolled: leaving the viewport doesn't reverse it.
  • <AnimateUIProvider tempo> paces the default transition and the 0.3s offset.
  • Under reduced motion, the letters sit in their final state at once.
  • Screen readers read the text once, not letter by letter.

API Reference

RollingText

PropTypeDefault
text
string-
transition?
Transition{ duration: 0.5, delay: 0.1, ease: 'easeOut' }
delay?
number0
inView?
booleanfalse
inViewMargin?
string'0px'
inViewOnce?
booleantrue
...props?
Omit<React.ComponentProps<'span'>, 'children'>-

Built by Skyleen. The source code is available on GitHub.

Last updated: 10/18/2026

On this page