Rotating Text
Animate through a series of words
Use the RotatingText
component to display dynamic text that changes through a series of words using animations. They are space efficient and can improve engagement. Use it to highlight key features, services, or taglines, or to display changing headlines or testimonials.
The RotatingText
component only requires a words
prop that defines a list of words to loop through in the form of an array of strings. You can customize text colors by defining the colors
prop. The colors are matched to the index of the words
array.
Delay
To customize the animation, you can configure the letter and word delay using the letterDelayAmount
and wordDelayAmount
props:
Animation Speed
Similar to configuring letter and word timing, you can also configure the animation timing using the animationInterval
prop. The lower the value, the faster the animation becomes:
Customize Animation
The animation can be further customized using the transformOrigin
prop. This changes the transform origin property of the letters that are animated using transforms:
Customize with CSS
The animation can also be customize via CSS. If you want to globally set the transformOrigin
prop, remove the prop from your components and override the following CSS variable instead:
API
Prop | Default | Purpose |
---|---|---|
words | [] | Sets the words that are animated. |
colors | [] | Sets the color of each word. Matches the index of the words prop. |
letterDelayAmount | 30 ms | Sets the animation delay between each letter. |
wordDelayAmount | 300 ms | Sets the animation delay between each word. |
animationInterval | 4000 ms | Sets the speed of the animation. |
transformOrigin | center | Sets the transform origin for the letters. |
className | - | Pass additional CSS classes for the text. |