Rolling Text

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

<script setup lang="ts">
import { RefreshIcon } from '@hugeicons/core-free-icons'
import { HugeiconsIcon } from '@hugeicons/vue'
import { RollingText } from '@animate-ui/vue/primitives/texts/rolling'
import { ref } from 'vue'
import { Button } from '@/components/ui/button'

withDefaults(defineProps<{ delay?: number }>(), { delay: 0 })

const run = ref(0)
</script>

<template>
  <div class="flex flex-col items-center gap-6">
    <RollingText
      :key="`${run}-${delay}`"
      :delay="Number(delay)"
      class="text-4xl font-semibold"
      text="Rolling Text"
    />
    <Button variant="outline" size="sm" @click="run++">
      <HugeiconsIcon :icon="RefreshIcon" :stroke-width="2" data-icon="inline-start" />
      Replay
    </Button>
  </div>
</template>

Installation

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

Usage

<script setup lang="ts">
import { RollingText } from '@animate-ui/vue/primitives/texts/rolling';
</script>

<template>
  <RollingText text="Rolling Text" in-view />
</template>

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
in-view?
booleanfalse
in-view-margin?
string'0px'
in-view-once?
booleantrue
...props?
HTMLAttributes-

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

Last updated: 10/23/2026