Installation
This guide will walk you through installing and using Motion Icons React in your project. The entire setup takes less than 2 minutes.Prerequisites
Before you begin, make sure you have:- Node.js 14 or higher installed
- A React project (16.8+ for hooks support)
- Basic familiarity with React components
Step 1: Install the Package
Install both Motion Icons React and Lucide React using your preferred package manager:Why lucide-react? Motion Icons React is built on top of Lucide React icons, so you’ll need both packages. Lucide provides the icon shapes, while Motion Icons adds the animation layer.
Step 2: Import the Styles
The animations require CSS to work. Import the stylesheet in your main application file: Where to add this:- Create React App:
src/index.tsxorsrc/App.tsx - Next.js:
pages/_app.tsxorapp/layout.tsx - Vite:
src/main.tsx
Step 3: Use Your First Animated Icon
Now you’re ready to use animated icons! Here’s how to convert a regular Lucide icon to an animated one:- Import
MotionIconinstead of individual icon components - Use the
nameprop to specify which icon (e.g., “Heart”, “Star”, “Bell”) - Add the
animationprop to choose an animation type
Good Defaults
All animation props are optional. Motion Icons React uses subtle, production-friendly defaults:- Size: 24px (standard icon size)
- Color:
currentColor(inherits from parent) - Animation:
none(static by default) - Duration: 1000ms (1 second)
- Trigger:
always(continuous animation) - Weight:
regular(balanced stroke)
Try Different Animations
Motion Icons React includes 15+ built-in animations. Here are some popular ones:- Spin Animation
- Bounce Animation
- Pulse Animation
Add Entrance Effects
Entrance animations play once when the icon first appears on screen. You can combine them with regular animations:- Icon zooms in when it first appears (entrance)
- Then continues pulsing indefinitely (animation)
Make Icons Interactive
Control when animations play using thetrigger prop:
"always"(default): Animation plays continuously"hover": Animation plays only when hovering"click": Animation plays on each click"focus": Animation plays when focused (keyboard navigation)
Next Steps
Now that you have Motion Icons React working, explore more features:Animation Types
Discover all 10+ available animations and entrance effects
Props Reference
Learn about all available props and customization options
Examples
See real-world examples and common patterns
Accessibility
Learn about accessibility features and best practices
Common Issues
Animations not working
Animations not working
Make sure you’ve imported the CSS file:
Icon not found
Icon not found
Ensure you’re using the correct Lucide icon name. Check the Lucide icon library for available icons.
TypeScript errors
TypeScript errors
Make sure you have the latest version of TypeScript and that both packages are properly installed.