Circle Menu
Dialog Form
Dominoes List Scroll
Dominoes Scroll Indicator
Eagle Vision
Electric AI Input
File Input
Flip Scroll
Glowing Scroll Indicator
Horizontal Scroll
Icon Wheel
Image Pile
Interactive CTA
Interactive Folder
Interest Picker
Jelly Loader
Leave Rating
Mask Cursor Effect
Magnet Tabs
Masonry Grid
OTP Input
Photo Gallery
Pixelated Carousel
Rolling Ball Scroll Indicator
Rubik Cube
Sidebar
Sine Wave
Skeumorphic Music Card
Social Media Card
Stacked Input Form
Stack Scroll
Trading Card
Bounce In Text
Text that starts at the bottom and bounces up to the top.
Install dependencies
npm i framer-motion
Utility function
Create a file lib/utils.ts and paste this code
import { ClassValue, clsx } from 'clsx';
import { twMerge } from 'tailwind-merge';
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs));
}
Bounce In Text
Create a file bounce-in-text.tsx in your components folder and paste this code
'use client';
import { cn } from '@/lib/utils';
import { motion } from 'framer-motion';
import React from 'react';
const BounceInText = ({ text, className }: { text: string; className?: string }) => {
return (
<div className={cn('flex flex-wrap items-center overflow-hidden justify-center', className)}>
{text.split('').map((char, index) => {
if (char === ' ')
return (
<span key={`bounce-in-text-${text}-${index}`} className="w-1">
{' '}
</span>
);
return (
<motion.span
initial={{ filter: 'blur(4px)', transform: 'translateY(100%)' }}
animate={{ filter: 'blur(0px)', transform: 'translateY(0%)' }}
transition={{
duration: 0.9,
type: 'spring',
bounce: 0.5,
delay: index * 0.05
}}
key={`bounce-in-text-${text}-${index}`}
className="inline-block"
>
{char}
</motion.span>
);
})}
</div>
);
};
export default BounceInText;
Usage
<BounceInText text="Bounce In Text" className="text-4xl" />