Using AOS (Animate On Scroll) in React with Tailwind CSS
If you want to add AOS (Animate On Scroll) animation to your component, here’s how you can do it step by step in a React + Tailwind CSS project:
✅ Step 1: Install AOS
npm install aos
✅ Step 2: Import and Initialize AOS
Add this in your main component (App.js, index.js, or where needed):
import AOS from 'aos';
import 'aos/dist/aos.css';
import { useEffect } from 'react';
useEffect(() => {
AOS.init({
duration: 1000, // animation duration in ms
once: true // animation occurs only once
});
}, []);
✅ Step 3: Use AOS Attributes in JSX
Add data-aos attributes to any element:
<div
className='flex justify-start items-center mt-2 gap-2'
data-aos="fade-up"
>
<span className='outfit text-[16px] md:text-[24px] font-medium text-[#4C9EC5] leading-none'>
Agnesh Rathor
</span>
<div className='flex gap-1'>
<Star className='text-[#ffcb0f] h-6 w-6' />
<Star className='text-[#ffcb0f] h-6 w-6' />
<Star className='text-[#ffcb0f] h-6 w-6' />
<Star className='text-[#ffcb0f] h-6 w-6' />
<Star className='text-[#ffcb0f] h-6 w-6' />
</div>
</div>
🔥 Popular AOS Animation Types
Type | Description |
---|---|
fade-up | Fades in and moves up |
fade-down | Fades in and moves down |
fade-left | Fades in from left |
fade-right | Fades in from right |
zoom-in | Zooms in |
zoom-out | Zooms out |
flip-left | Flip from left |
flip-right | Flip from right |
slide-up | Slides up |
slide-down | Slides down |
⚙️ Custom AOS Attributes
You can customize each animation with these optional attributes:
data-aos="fade-up"
data-aos-delay="200" <!-- Delay in milliseconds -->
data-aos-duration="1500" <!-- Duration of the animation -->
data-aos-offset="120" <!-- Trigger offset -->
data-aos-easing="ease-in-out"

Sandipan Kr Bag
I'm a dedicated full-stack developer, entrepreneur, and the proud owner of ocec.org.in , hailing from the vibrant country of India. My passion lies in creating informative tutorials and sharing valuable tips that empower fellow artisans in their journey. With a deep-rooted love for technology, I've been an ardent enthusiast of PHP, Laravel, Angular, Vue, Node, JavaScript, jQuery, Codeigniter, and Bootstrap from their earliest days. My philosophy revolves around the values of hard work and unwavering consistency, driving me to continuously explore, create, and share my knowledge with the tech community.
* Hire MeRelated Posts

জাভাস্ক্রিপ্ট কি? এটি কেন ব্যবহার করা হয় ?

জাভাস্ক্রিপ্ট লেখার পদ্ধতি
Step-by-Step Guide a Dynamic Image Slider with HTML, CSS, and JavaScript
Search
Latest Posts
Using AOS (Animate On Scroll) in React with Tailwind CSS
1 month ago

WebkitSpeechRecognition API
2 months ago

GitHub Understanding Common Prefixes in Conventional Commits
2 months ago
Subscribe to Our Newsletter
Get the latest updates straight to your inbox.