Blur Text

Text animation with a blur reveal effect.

Installation

pnpm dlx shadcn@latest add "https://vritti.thesatyajit.com/r/blur-text"

Dependencies

pnpm add motion

Examples

Direction

import BlurText from "@/components/vritti/blur-text";

export function BlurTextDirectionExample() {
  return (
    <div className="flex flex-col items-center justify-center gap-8 p-8">
      <div className="text-center">
        <p className="text-xs text-muted-foreground mb-2">direction: top</p>
        <BlurText text="Blur from top" direction="top" className="text-2xl font-bold" />
      </div>
      <div className="text-center">
        <p className="text-xs text-muted-foreground mb-2">direction: bottom</p>
        <BlurText text="Blur from bottom" direction="bottom" className="text-2xl font-bold" />
      </div>
    </div>
  );
}

Letters

import BlurText from "@/components/vritti/blur-text";

export function BlurTextLettersExample() {
  return (
    <div className="flex flex-col items-center justify-center gap-8 p-8">
      <div className="text-center">
        <p className="text-xs text-muted-foreground mb-2">animateBy: words (default)</p>
        <BlurText text="Animate by words" animateBy="words" className="text-2xl font-bold" />
      </div>
      <div className="text-center">
        <p className="text-xs text-muted-foreground mb-2">animateBy: letters</p>
        <BlurText text="Animate by letters" animateBy="letters" delay={30} className="text-2xl font-bold" />
      </div>
    </div>
  );
}

Props

Blur Text

PropTypeDefaultDescription
textstringHello WorldText to animate
delaynumber200Delay between each word/letter in ms
animateByselectwordsAnimate by words or letters
directionselecttopDirection of the blur animation