Text Animate
A text animation component that animates text using a variety of different animations.
Blur in by character
import { TextAnimate } from '@/registry/magicui/text-animate'
export function TextAnimateDemo() { return ( <TextAnimate animation="blurInUp" by="character" once> Blur in by character </TextAnimate> )}Installation
Section titled “Installation”pnpm dlx shadcn@latest add @magicui-solid/text-animatebunx shadcn@latest add @magicui-solid/text-animateyarn dlx shadcn@latest add @magicui-solid/text-animatenpx shadcn@latest add @magicui-solid/text-animateExamples
Section titled “Examples”Blur In by Text
Section titled “Blur In by Text”Blur in text
import { TextAnimate } from '@/registry/magicui/text-animate'
export function TextAnimateDemo2() { return ( <TextAnimate animation="blurIn" as="h1"> Blur in text </TextAnimate> )}Slide Up by Word
Section titled “Slide Up by Word”Slide up by word
import { TextAnimate } from '@/registry/magicui/text-animate'
export function TextAnimateDemo3() { return ( <TextAnimate animation="slideUp" by="word"> Slide up by word </TextAnimate> )}Scale Up by Text
Section titled “Scale Up by Text”Scale up by text
import { TextAnimate } from '@/registry/magicui/text-animate'
export function TextAnimateDemo4() { return ( <TextAnimate animation="scaleUp" by="text"> Scale up by text </TextAnimate> )}Fade In by Line
Section titled “Fade In by Line”Fade in by line as paragraph Fade in by line as paragraph Fade in by line as paragraph
import { TextAnimate } from '@/registry/magicui/text-animate'
export function TextAnimateDemo5() { return ( <TextAnimate animation="fadeIn" by="line" as="p"> {`Fade in by line as paragraph\n\nFade in by line as paragraph\n\nFade in by line as paragraph`} </TextAnimate> )}Slide Left by Character
Section titled “Slide Left by Character”Slide left by character
import { TextAnimate } from '@/registry/magicui/text-animate'
export function TextAnimateDemo6() { return ( <TextAnimate animation="slideLeft" by="character"> Slide left by character </TextAnimate> )}With Delay
Section titled “With Delay”Blur in by character
import { TextAnimate } from '@/registry/magicui/text-animate'
export function TextAnimateDemo7() { return ( <TextAnimate animation="blurInUp" by="character" delay={2}> Blur in by character </TextAnimate> )}With Duration
Section titled “With Duration”Blur in by character
import { TextAnimate } from '@/registry/magicui/text-animate'
export function TextAnimateDemo8() { return ( <TextAnimate animation="blurInUp" by="character" duration={5}> Blur in by character </TextAnimate> )}With Custom Motion Variants
Section titled “With Custom Motion Variants”Wavy Motion!
import { TextAnimate } from '@/registry/magicui/text-animate'
export function TextAnimateDemo9() { return ( <TextAnimate variants={{ hidden: { opacity: 0, y: 30, rotate: 45, scale: 0.5, }, show: i => ({ opacity: 1, y: 0, rotate: 0, scale: 1, transition: { delay: i * 0.1, duration: 0.4, y: { type: 'spring', damping: 12, stiffness: 200, mass: 0.8, }, rotate: { type: 'spring', damping: 8, stiffness: 150, }, scale: { type: 'spring', damping: 10, stiffness: 300, }, }, }), exit: i => ({ opacity: 0, y: 30, rotate: 45, scale: 0.5, transition: { delay: i * 0.1, duration: 0.4, }, }), }} by="character" > Wavy Motion! </TextAnimate> )}Import
Section titled “Import”import { TextAnimate } from '@/components/magicui/text-animate'<TextAnimate animation="blurInUp" by="word"> Blur in by word</TextAnimate>| Prop | Type | Default | Description |
|---|---|---|---|
children |
string |
- |
The text content to animate |
class |
string |
- |
The class name to be applied to the component |
segmentClassName |
string |
- |
The class name to be applied to each segment |
delay |
number |
0 |
Delay before animation starts |
duration |
number |
0.3 |
Duration of the animation |
variants |
Variants |
- |
Custom motion variants for the animation |
as |
ValidComponent |
"p" |
The element to render |
by |
"text" "word" "character" "line" |
"word" |
How to split the text (“text”, “word”, “character”) |
startOnView |
boolean |
true |
Whether to start animation when component enters viewport |
once |
boolean |
false |
Whether to animate only once |
animation |
AnimationVariant |
"fadeIn" |
The animation preset to use |
accessible |
boolean |
true |
Whether to render an accessible screen-reader label |
Original:
magicui.design/docs/components/text-animate