UNPKG

@appletosolutions/reactbits

Version:

A comprehensive collection of beautiful, performant React animation components including bounce effects, click sparks, star borders, scroll-triggered animations, and fade transitions.

551 lines (419 loc) • 16.1 kB
<div align="center"> # šŸŽØ ReactBits **The Ultimate React Animation Library** [![npm version](https://img.shields.io/npm/v/@appletosolutions/reactbits?style=for-the-badge&color=blue)](https://www.npmjs.com/package/@appletosolutions/reactbits) [![downloads](https://img.shields.io/npm/dm/@appletosolutions/reactbits?style=for-the-badge&color=green)](https://www.npmjs.com/package/@appletosolutions/reactbits) [![GitHub stars](https://img.shields.io/github/stars/appletosolutions/reactbits?style=for-the-badge&color=yellow)](https://github.com/appletosolutions/reactbits) [![MIT License](https://img.shields.io/github/license/appletosolutions/reactbits?style=for-the-badge&color=orange)](./LICENSE) **80+ Production-Ready Animation Components** • **TypeScript First** • **Zero Config** • **Tree Shakeable** Transform your React apps with stunning animations that actually perform in production. [**šŸš€ Get Started**](#-installation) • [**šŸ“– Documentation**](#-components) • [**šŸŽ® Examples**](#-examples) • [**šŸ’” Showcase**](#-showcase) </div> ## 🌟 Why ReactBits? ReactBits isn't just another animation library. It's a **complete animation ecosystem** designed for modern React applications. ### ⚔ **Performance First** - **Canvas & WebGL optimized** for 60fps animations - **Tree-shakeable** - only bundle what you use - **Memory efficient** with proper cleanup - **Mobile optimized** with touch interactions ### šŸŽÆ **Developer Experience** - **Zero configuration** - works out of the box - **TypeScript native** with full type safety - **Composable** - combine animations effortlessly - **Consistent API** across all components ### šŸŽØ **Production Ready** - **80+ components** from simple fades to complex 3D effects - **Battle tested** in production applications - **Accessible** with proper ARIA support - **Framework agnostic** - works with Next.js, Vite, CRA ### šŸš€ **Unique Features** - **3D Model Viewer** with physics and lighting - **Shader-based effects** for premium visuals - **Particle systems** with WebGL acceleration - **Advanced text animations** with character-level control ## šŸ“¦ Installation ```bash # npm npm install @appletosolutions/reactbits # yarn yarn add @appletosolutions/reactbits # pnpm pnpm add @appletosolutions/reactbits ``` ### Peer Dependencies ReactBits uses peer dependencies to avoid conflicts and reduce bundle size. Install only what you need: ```bash # Required for all components npm install react react-dom # For 3D components (ModelViewer, Aurora, etc.) npm install three @react-three/fiber @react-three/drei # For GSAP-powered animations (Bounce, ScrollReveal, etc.) npm install gsap # For physics-based animations (Ballpit, etc.) npm install matter-js # For Chakra UI components (optional) npm install @chakra-ui/react @emotion/react @emotion/styled # For Framer Motion components (optional) npm install framer-motion ``` ### āš ļø Troubleshooting **Dependency Resolution Errors**: If you encounter "Could not resolve" errors for dependencies like `matter-js`, `@react-three/fiber`, etc.: ```bash # Install only the peer dependencies you need npm install three @react-three/fiber @react-three/drei # For 3D components npm install matter-js # For physics components npm install gsap # For GSAP animations # Use --legacy-peer-deps if needed npm install @appletosolutions/reactbits --legacy-peer-deps ``` **Bundle Size Optimization**: ReactBits uses peer dependencies to keep your bundle small: ```bash # Check what's included in your bundle npm run build -- --analyze # For Create React App with bundle analyzer # Only install dependencies for components you use npm install gsap # Only if using GSAP-powered components npm install three # Only if using 3D components ``` **TypeScript Errors**: Ensure you have the correct type definitions: ```bash npm install --save-dev @types/three @types/matter-js ``` **Framework-Specific Issues**: - **Next.js**: Add to `next.config.js`: ```js module.exports = { transpilePackages: ['@appletosolutions/reactbits'] } ``` - **Vite**: Add to `vite.config.ts`: ```js export default defineConfig({ optimizeDeps: { include: ['@appletosolutions/reactbits'] } }) ``` ## šŸš€ Quick Start Get up and running in 30 seconds: ```jsx import { Bounce, ClickSpark, StarBorder } from '@appletosolutions/reactbits'; function App() { return ( <div> {/* Bounce animation on mount */} <Bounce> <h1>Welcome to ReactBits! šŸŽ‰</h1> </Bounce> {/* Interactive click effects */} <ClickSpark sparkColor="#ff6b6b" sparkCount={12}> <button className="btn-primary"> Click for sparks! ✨ </button> </ClickSpark> {/* Animated border effects */} <StarBorder color="#00d4ff" speed="3s"> <div className="premium-card"> Premium Feature ⭐ </div> </StarBorder> </div> ); } ``` **That's it!** No configuration, no setup, just beautiful animations. ## 🧩 Component Categories <details> <summary><strong>šŸ“ Text Animations (20+ components)</strong></summary> Perfect for headlines, CTAs, and dynamic content: - **`SplitText`** - Character-by-character animations - **`BlurText`** - Smooth blur-to-focus transitions - **`GlitchText`** - Cyberpunk-style glitch effects - **`ScrambleText`** - Matrix-style character scrambling - **`ShinyText`** - Metallic shine effects - **`GradientText`** - Animated gradient text - **`DecryptedText`** - Decryption animation effect - **`FallingText`** - Gravity-based text animations - **`CountUp`** - Animated number counters - And 11 more... </details> <details> <summary><strong>✨ Interactive Effects (15+ components)</strong></summary> Engage users with responsive animations: - **`ClickSpark`** - Particle explosions on click - **`StarBorder`** - Animated star borders - **`GlareHover`** - Metallic hover effects - **`MagnetLines`** - Magnetic line attractions - **`PixelTrail`** - Mouse-following pixel effects - **`SplashCursor`** - Liquid cursor interactions - **`BlobCursor`** - Morphing blob cursor - **`ImageTrail`** - Image-following mouse trails - And 7 more... </details> <details> <summary><strong>šŸŽØ Background Effects (20+ components)</strong></summary> Transform your layouts with stunning backgrounds: - **`Aurora`** - Northern lights shader effect - **`Particles`** - WebGL particle systems - **`Lightning`** - Electric lightning effects - **`Silk`** - Flowing silk animations - **`MetaBalls`** - Liquid blob animations - **`GridDistortion`** - Warping grid effects - **`Hyperspeed`** - Star field animations - **`LiquidChrome`** - Metallic liquid effects - And 12 more... </details> <details> <summary><strong>šŸ—ļø Layout Components (15+ components)</strong></summary> Enhance your UI with animated layouts: - **`AnimatedList`** - Staggered list animations - **`Carousel`** - Smooth carousel transitions - **`Stack`** - Card stack interactions - **`Dock`** - macOS-style dock effects - **`InfiniteScroll`** - Smooth infinite scrolling - **`ElasticSlider`** - Physics-based sliders - **`FlowingMenu`** - Fluid menu animations - **`CircularGallery`** - 3D circular galleries - And 7 more... </details> <details> <summary><strong>🌐 3D Components (10+ components)</strong></summary> Professional 3D effects powered by Three.js: - **`ModelViewer`** - Interactive 3D model display - **`FlyingPosters`** - 3D scrolling galleries - **`Ballpit`** - Physics-based ball animations - **`Orb`** - Floating 3D orbs - **`Waves`** - Ocean wave simulations - **`ChromaGrid`** - Chromatic aberration grids - And 4 more... </details> ## šŸŽ® Examples ### šŸŽÆ **Simple Animations** ```jsx // Bounce effect on page load <Bounce> <h1>Welcome! šŸ‘‹</h1> </Bounce> // Fade in with blur effect <FadeContent blur={true} duration={1000}> <img src="/hero.jpg" alt="Hero" /> </FadeContent> // Scroll-triggered slide animation <AnimatedContent direction="vertical" distance={100}> <div>Slides up when scrolled into view</div> </AnimatedContent> ``` ### ⚔ **Interactive Effects** ```jsx // Click sparks with custom colors <ClickSpark sparkColor="#ff6b6b" sparkCount={15} sparkRadius={30}> <button className="cta-button"> Click me for fireworks! šŸŽ† </button> </ClickSpark> // Animated star border <StarBorder color="#ffd700" speed="2s"> <div className="premium-badge"> ⭐ Premium Feature </div> </StarBorder> // Magnetic hover effect <Magnet strength={0.3} range={100}> <div className="magnetic-card"> Hover to see magnetic attraction </div> </Magnet> ``` ### šŸŽØ **Background Effects** ```jsx // Aurora background with custom colors <Aurora colorStops={["#ff6b6b", "#4ecdc4", "#45b7d1"]} amplitude={1.2} speed={0.8} /> // Particle system background <Particles particleCount={150} particleColors={["#ff6b6b", "#4ecdc4"]} moveParticlesOnHover={true} /> // Animated grid distortion <GridDistortion gridSize={20} distortionStrength={0.5} animationSpeed={1.0} /> ``` ### šŸ—ļø **Complex Compositions** ```jsx // Multi-layered landing page <div className="hero-section"> <Aurora colorStops={["#667eea", "#764ba2"]} /> <FadeContent blur={true} duration={1200}> <Bounce delay={500}> <h1>ReactBits Animation Library</h1> </Bounce> <AnimatedContent direction="vertical" delay={800}> <p>80+ components for stunning React animations</p> <ClickSpark sparkColor="#ffd700" sparkCount={20}> <StarBorder color="#00d4ff"> <button>Get Started Now</button> </StarBorder> </ClickSpark> </AnimatedContent> </FadeContent> </div> ``` ### 🌐 **3D Showcase** ```jsx // Interactive 3D model viewer <ModelViewer url="/models/product.glb" width={600} height={400} autoRotate={true} enableMouseParallax={true} /> // Flying posters gallery <FlyingPosters items={[ { image: "/poster1.jpg", title: "Project 1" }, { image: "/poster2.jpg", title: "Project 2" }, { image: "/poster3.jpg", title: "Project 3" } ]} distortion={2.5} /> ``` > šŸ’” **Pro Tip**: All components are composable! Mix and match to create unique effects. šŸ“– **[View Complete Examples →](./examples.md)** ## šŸ’” Showcase ### šŸ† **Built with ReactBits** <table> <tr> <td align="center"> <img src="https://via.placeholder.com/300x200/667eea/ffffff?text=E-commerce+Hero" alt="E-commerce" width="300"/> <br><strong>E-commerce Landing</strong> <br><em>Aurora + ClickSpark + StarBorder</em> </td> <td align="center"> <img src="https://via.placeholder.com/300x200/764ba2/ffffff?text=Portfolio+Gallery" alt="Portfolio" width="300"/> <br><strong>Portfolio Gallery</strong> <br><em>FlyingPosters + ModelViewer</em> </td> </tr> <tr> <td align="center"> <img src="https://via.placeholder.com/300x200/ff6b6b/ffffff?text=Dashboard+UI" alt="Dashboard" width="300"/> <br><strong>Analytics Dashboard</strong> <br><em>AnimatedList + CountUp + Particles</em> </td> <td align="center"> <img src="https://via.placeholder.com/300x200/4ecdc4/ffffff?text=Gaming+Interface" alt="Gaming" width="300"/> <br><strong>Gaming Interface</strong> <br><em>GlitchText + Lightning + MetaBalls</em> </td> </tr> </table> ### šŸŽÆ **Perfect For** - **šŸ›ļø E-commerce** - Product showcases, CTAs, checkout flows - **šŸ’¼ SaaS Applications** - Onboarding, dashboards, feature highlights - **šŸŽØ Portfolios** - Creative showcases, project galleries - **šŸ“± Mobile Apps** - Touch interactions, micro-animations - **šŸŽ® Gaming** - UI effects, loading screens, achievements - **šŸ“Š Data Visualization** - Chart animations, progress indicators ## šŸŽØ Styling & Customization ReactBits components are **unstyled by default**, giving you complete design freedom: ```jsx // Use with any CSS framework <ClickSpark className="my-custom-button"> <button className="btn btn-primary">Tailwind Button</button> </ClickSpark> // Or with CSS-in-JS <StarBorder style={{ borderRadius: '12px' }} color="#ff6b6b" > <div className="styled-component">Custom Styled</div> </StarBorder> ``` ### šŸŽØ **Framework Compatibility** āœ… **Tailwind CSS** - Perfect integration āœ… **Styled Components** - Full support āœ… **Emotion** - Works seamlessly āœ… **CSS Modules** - Complete compatibility āœ… **Vanilla CSS** - No restrictions ## šŸš€ Performance ReactBits is built for production with performance as a top priority: | Metric | ReactBits | Framer Motion | React Spring | |--------|-----------|---------------|--------------| | **Bundle Size** | 50KB (core) | 180KB | 120KB | | **Tree Shaking** | āœ… Full | āš ļø Partial | āš ļø Partial | | **WebGL Support** | āœ… Yes | āŒ No | āŒ No | | **3D Components** | āœ… 10+ | āŒ No | āŒ No | | **Canvas Animations** | āœ… Yes | āŒ No | āŒ No | ### šŸ“Š **Benchmarks** - **60fps** animations on mobile devices - **<16ms** render times for complex effects - **Zero layout thrashing** with transform-based animations - **Memory efficient** with automatic cleanup ## šŸ› ļø Framework Support | Framework | Support | Notes | |-----------|---------|-------| | **Next.js** | āœ… Full | SSR compatible | | **Vite** | āœ… Full | Optimized builds | | **Create React App** | āœ… Full | Zero config | | **Remix** | āœ… Full | SSR compatible | | **Gatsby** | āœ… Full | Static generation | ## šŸ¤ Contributing We love contributions! Here's how to get started: ### šŸ› **Bug Reports** Found a bug? [Open an issue](https://github.com/appletosolutions/reactbits/issues) with: - Clear description - Reproduction steps - Expected vs actual behavior - Environment details ### šŸ’” **Feature Requests** Have an idea? [Start a discussion](https://github.com/appletosolutions/reactbits/discussions) to: - Describe your use case - Explain the proposed solution - Discuss implementation details ### šŸ”§ **Development** ```bash # Clone the repository git clone https://github.com/appletosolutions/reactbits.git # Install dependencies npm install # Start development npm run dev # Run tests npm test # Build library npm run build ``` ### šŸ“ **Pull Requests** 1. Fork the repository 2. Create your feature branch (`git checkout -b feature/amazing-animation`) 3. Write tests for your changes 4. Ensure all tests pass (`npm test`) 5. Commit your changes (`git commit -m 'Add amazing animation'`) 6. Push to the branch (`git push origin feature/amazing-animation`) 7. Open a Pull Request ## šŸ¢ About **ReactBits** is crafted with ā¤ļø by [**Appleto Solutions**](https://appletosolutions.com) - 🌐 **Website**: [appletosolutions.com](https://appletosolutions.com) - šŸ“§ **Contact**: [hello@appletosolutions.com](mailto:hello@appletosolutions.com) - 🐦 **Twitter**: [@AppletoSolutions](https://twitter.com/AppletoSolutions) - šŸ’¼ **LinkedIn**: [Appleto Solutions](https://linkedin.com/company/appletosolutions) ### 🌟 **Support the Project** If ReactBits helps your project, consider: - ⭐ **Starring** the repository - 🐦 **Sharing** on social media - šŸ’ **Sponsoring** development - šŸ¤ **Contributing** code or ideas ## šŸ“„ License MIT Ā© [Appleto Solutions](https://appletosolutions.com) --- <div align="center"> **Made with ā¤ļø for the React community** [⭐ Star on GitHub](https://github.com/appletosolutions/reactbits) • [šŸ“¦ View on NPM](https://www.npmjs.com/package/@appletosolutions/reactbits) • [šŸ“– Documentation](./examples.md) </div>