Leave a star on GitHub! ⭐


Docs
Letter Pull Up

Letter Pull Up

Text animation where each letter pulls up into place.

L

e

t

t

e

r

 

P

u

l

l

 

U

p

Installation

pnpm add clsx framer-motion

Copy and paste the following code into your project.

components/eldoraui/letterpullup.tsx

"use client";
import clsx from "clsx";
import { motion } from "framer-motion";
 
interface LetterPullUpProps {
  text?: string;
  className?: string;
}
 
export const LetterPullUp: React.FC<LetterPullUpProps> = ({
  text = "",
  className = "",
}) => {
  const letters = text.split("");
 
  const pullupVariant = {
    initial: { y: 100, opacity: 0 },
    animate: (i: number) => ({
      y: 0,
      opacity: 1,
      transition: {
        delay: i * 0.05, // Delay each letter's animation by 0.05 seconds
        duration: 0.5, // Adjust duration for smoothness
      },
    }),
  };
 
  return (
    <div className={clsx("flex justify-center", className)}>
      {letters.map((letter, i) => (
        <motion.h1
          key={i}
          variants={pullupVariant}
          initial="initial"
          animate="animate"
          custom={i}
          className={clsx(
            "text-center font-display font-bold drop-shadow-sm",
            "text-4xl md:text-5xl lg:text-6xl xl:text-7xl",
            "tracking-[-0.02em]",
            "md:leading-[4rem] lg:leading-[4.5rem] xl:leading-[5rem]",
          )}
        >
          {letter === " " ? <span>&nbsp;</span> : letter}
        </motion.h1>
      ))}
    </div>
  );
};

Update the import paths to match your project setup.

Props

Prop NameTypeDefaultDescription
textstring""The text content to be displayed inside the motion.h1.
classNamestring""Additional CSS classes to apply to the component for custom styling.