Skip to content

TextRotate

Animated text that cycles through multiple options in a loop.

import { TextRotate } from 'asterui'

Basic

Simple rotating text with multiple languages.

HelloSalutHolaCiaoHallo
import { TextRotate } from 'asterui'

function App() {
  return (
      <TextRotate
        items={['Hello', 'Salut', 'Hola', 'Ciao', 'Hallo']}
        className="text-4xl font-bold"
      />
    )
}

export default App

Centered

Center-aligned rotating text.

Build fasterShip soonerScale easilySleep better
import { TextRotate } from 'asterui'

function App() {
  return (
      <TextRotate
        items={[
          'Build faster',
          'Ship sooner',
          'Scale easily',
          'Sleep better',
        ]}
        centered
        className="text-3xl font-semibold text-primary"
      />
    )
}

export default App

Styled Items

Each item can have custom styling.

CreativeInnovativeDynamicPowerful
import { TextRotate } from 'asterui'

function App() {
  return (
      <TextRotate
        items={[
          <span className="text-primary">Creative</span>,
          <span className="text-secondary">Innovative</span>,
          <span className="text-accent">Dynamic</span>,
          <span className="text-success">Powerful</span>,
        ]}
        className="text-5xl font-black"
      />
    )
}

export default App

Custom Duration

Faster rotation with 6 second cycle.

BLAZINGFAST ▶︎▶︎
import { TextRotate } from 'asterui'

function App() {
  return (
      <TextRotate
        items={[
          'BLAZING',
          <span className="font-bold italic px-2">FAST ▶︎▶︎</span>,
        ]}
        duration={6000}
        centered
        className="text-7xl"
      />
    )
}

export default App
PropertyDescriptionTypeDefault
itemsText items to rotate through (max 6)React.ReactNode[]-
durationAnimation duration in ms6000 | 9000 | 12000 | 15000 | 1800010000
centeredCenter text horizontallybooleanfalse
classNameAdditional CSS classesstring-
data-testidTest ID for testingstring-
  • Animation pauses on hover for easier reading
  • Supports reduced motion preferences
  • Text remains readable at all animation states