A modern React component that animates the appearance of each word for dynamic, attractive text transitions. Perfect for headlines, hero sections, or anywhere dynamic, eye-catching text is needed.
Inspired by popular animated heading techniques found in top-tier UIs.
You can install the AnimatedText component with the following CLI command, or copy the implementation manually:
1npx shadcn@latest add http://localhost:3000/r/animated-text.jsonTo use the AnimatedText component, import it in your code:
1import AnimatedText from '@/components/AnimatedText';The AnimatedText component accepts the following props:
| Prop | Type | Default | Description | Required |
|---|---|---|---|---|
children | string | - | The text to animate, one word at a time. | Yes |
className | string | - | Utility classes for controlling text style/size/weight. | No |
1type AnimatedTextProps = {
2 children: string;
3 className?: string;
4};1<AnimatedText>This is an animated text.</AnimatedText>1<AnimatedText className="text-3xl text-blue-700">Big & Blue</AnimatedText>1<AnimatedText className="uppercase tracking-widest">Fancy Style Reveal</AnimatedText>motion.span logicframer-motion or motion library variantschildren prop is a string (not JSX/element), or the effect will not render as intended.