Animated Text

A powerful text animation component with 5 preset effects (fade, slide, blur, fade-in-blur, scale) and support for word, character, and line-based animations. Fully customizable with advanced Framer Motion controls and TypeScript support.

Smooth fade animation

Words slide up smoothly

Blur into focus

Fade and blur combined

Scale up animation

Character by character

Installation

animated-text.tsx

Props

The TextEffect component accepts the following props:

NameTypeDefaultDescription
children
stringThe text content to be animated.
preset
"blur" | "fade-in-blur" | "scale" | "fade" | "slide""fade"Animation preset style: "fade", "slide", "blur", "fade-in-blur", or "scale".
per
"word" | "char" | "line""word"Animation unit: "word" (animates word by word), "char" (animates character by character), or "line" (animates line by line).
className
stringAdditional CSS classes to apply to the text container. Use for styling text size, color, font, etc.
delay
number0Delay before animation starts in seconds. Applies to the entire text animation sequence.
speedReveal
number1Controls the stagger speed between animated units. Higher values = faster reveal. Multiplier applied to default stagger timing.
speedSegment
number1Controls the animation duration of each segment. Higher values = faster individual animations.
trigger
booleantrueWhether the animation should play. Set to false to unmount/hide the animation.
as
keyof React.JSX.IntrinsicElements"p"HTML element to render as (e.g., h1, h2, p, span, div). Useful for semantic markup and accessibility.
variants
{ container?: Variants; item?: Variants }undefinedCustom Framer Motion variants for advanced animation control. Overrides preset animations.
onAnimationComplete
() => voidundefinedCallback function triggered when the animation completes.
onAnimationStart
() => voidundefinedCallback function triggered when the animation starts.
segmentWrapperClassName
stringundefinedAdditional CSS classes to apply to each animated segment wrapper. Useful for fine-grained styling control.
containerTransition
TransitionundefinedCustom Framer Motion transition configuration for the container element. Overrides default transition timing.
segmentTransition
TransitionundefinedCustom Framer Motion transition configuration for each animated segment. Allows per-segment animation customization.
style
React.CSSPropertiesundefinedInline CSS styles to apply to the container element. Use for dynamic styling that can't be achieved with className.