Pick Your Framework
Start by selecting your framework of choice. Motion Icons React works seamlessly with all modern React frameworks.Next.js
Set up Motion Icons React in your Next.js application (App Router or Pages Router)
Vite
Set up Motion Icons React in your Vite + React application
Quick Installation
If you just want to install the packages quickly, use one of these commands:Why lucide-react? Motion Icons React is built on top of Lucide React icons. Lucide provides the icon shapes, while Motion Icons adds the animation layer.
General Setup
After installation, follow these general steps for any React project:Step 1: Import CSS
Import the required CSS file in your main application file:Step 2: Use Animated Icons
Import and use the MotionIcon component:TypeScript Configuration
Motion Icons React includes full TypeScript support out of the box. No additional configuration is needed. If you’re using TypeScript, you’ll get:- Full type safety for all props
- IntelliSense for icon names
- Autocomplete for animation types
- Type checking for all component properties
Verification
Test your installation with this simple component. Copy and paste this into any component file:- ✅ A blue check mark icon appears
- ✅ The icon bounces up and down smoothly
- ❌ If the icon is static, check that you imported the CSS file
- ❌ If nothing appears, check the browser console for errors
Troubleshooting
CSS not loading
CSS not loading
Problem: Icons appear but animations don’t work.Solution: Make sure you’ve imported the CSS file:
Module not found error
Module not found error
Problem:
Cannot resolve module 'motion-icons-react'
Solution:- Ensure the package is installed:
npm list motion-icons-react
- Try deleting
node_modules
and reinstalling:rm -rf node_modules && npm install
- Check that you’re importing from the correct package name
TypeScript errors
TypeScript errors
Problem: TypeScript compilation errorsSolution:
- Ensure you have TypeScript 4.0 or higher
- Check that both packages are properly installed
- Restart your TypeScript language server
Icons not displaying
Icons not displaying
Problem: Nothing appears where the icon should beSolution:
- Verify the icon name exists in Lucide: lucide.dev/icons
- Check for console errors
- Ensure the component is properly imported
Bundle Size
Motion Icons React is designed to be lightweight:- Core library: ~15KB gzipped
- CSS animations: ~8KB gzipped
- Total impact: ~23KB gzipped
Browser Support
Motion Icons React supports all modern browsers:- Chrome 60+
- Firefox 55+
- Safari 12+
- Edge 79+
Animations automatically fall back gracefully in older browsers and respect the user’s
prefers-reduced-motion
setting.