Background

Sparkles

Magical particle animations that bring websites to life. This interactive React component creates captivating sparkle effects perfect for Next.js applications requiring enchanting visual elements.

Loading component...

Installation

npx shadcn@latest add https://www.shadcn.io/registry/sparkles.json
npx shadcn@latest add https://www.shadcn.io/registry/sparkles.json
pnpm dlx shadcn@latest add https://www.shadcn.io/registry/sparkles.json
bunx shadcn@latest add https://www.shadcn.io/registry/sparkles.json

Features

  • Interactive click-to-sparkle adding four new particles with realistic physics on user interaction
  • Hardware-accelerated rendering maintaining smooth 60fps performance across all devices
  • Flexible color customization supporting hex, RGB, or HSL values for brand matching
  • Configurable particle density from subtle ambience (50 particles) to magical celebrations (300+)
  • TypeScript support with complete type safety for reliable React development
  • Mobile-optimized performance with automatic device detection and performance scaling
  • tsParticles integration leveraging industry-leading particle engine for professional effects
  • Framer Motion compatibility for seamless fade-in animations and motion preferences

Examples

Full Page Background

Loading component...

Create immersive full-screen experiences perfect for portfolio sites and creative showcases.

Colorful Particles

Loading component...

Brand-matched particle effects that harmonize with your existing design language and color palette.

Use Cases

This free open source React component works well for:

  • Creative portfolios - Artistic backgrounds showcasing innovation without overwhelming content built with Next.js
  • Product launches - Interactive celebration effects generating excitement during key moments using TypeScript
  • Gaming interfaces - Magical atmosphere for dashboards and character selection screens
  • Event websites - Dynamic particle systems creating anticipation with user engagement using shadcn/ui design
  • Interactive showcases - Demonstrating technical skill with smooth, performant animations
  • Brand experiences - Expressing personality through customizable colors and interaction patterns using Tailwind CSS

API Reference

SparklesCore

PropTypeDefaultDescription
idstringauto-generatedUnique identifier for the particles instance
classNamestring-Additional CSS classes for the container
backgroundstring"#0d47a1"Background color of the particles container
minSizenumber1Minimum size of particles
maxSizenumber3Maximum size of particles
speednumber4Animation speed of particle opacity changes
particleColorstring"#ffffff"Color of the particles (hex, rgb, hsl)
particleDensitynumber120Number of particles to render

Implementation Notes

  • Component uses tsParticles engine with hardware acceleration for optimal performance
  • Click interactions spawn four particles per click with realistic physics and collision dynamics
  • Particle density configurable from 50 (subtle) to 300+ (celebration) for different use cases
  • Color customization supports hex (#ff6b6b), RGB (rgb(107, 203, 255)), and HSL (hsl(290, 100%, 71%)) formats
  • Mobile optimization automatically reduces particle count for smooth 60fps on all devices
  • Background transparency supported via background="transparent" for overlay effects
  • Framer Motion integration provides smooth fade-in animations respecting user motion preferences
  • Memory management includes automatic cleanup preventing performance degradation over time
  • Compatible with shadcn/ui design system and Tailwind CSS utility classes