Backgrounds Fancy Stable
Sparkles
Canvas-based floating particle sparkle effect with configurable density and colors
Available for Svelte 5, React, and Vue 3.
Preview
svelte
<script lang="ts">
import { Sparkles } from 'fancy-ui-svelte';
</script>
<Sparkles background="#0b1020" particleColor="currentColor" particleDensity={160} class="text-white" />Installation
pnpm add fancy-ui-svelte
import { Sparkles } from "fancy-ui-svelte";
Usage
svelte
<script lang="ts">
import { Sparkles } from 'fancy-ui-svelte';
</script>
<Sparkles background="#0b1020" particleColor="currentColor" particleDensity={160} class="text-white" />Examples
Basic Usage
svelte
<script lang="ts">
import { Sparkles } from "$lib/fancy-ui/sparkles";
</script>
<div class="h-64 w-full overflow-hidden rounded-lg border">
<Sparkles />
</div>Custom Colors
svelte
<script lang="ts">
import { Sparkles } from "$lib/fancy-ui/sparkles";
</script>
<div class="h-64 w-full overflow-hidden rounded-lg border">
<Sparkles background="#1a0533" particleColor="#e879f9" speed={2} particleDensity={80} />
</div>Dense & Fast
More particles, faster speed.
svelte
<script lang="ts">
import { Sparkles } from "$lib/fancy-ui/sparkles";
</script>
<div class="h-64 w-full overflow-hidden rounded-lg border">
<Sparkles
background="#0c1222"
particleColor="#fbbf24"
speed={8}
particleDensity={200}
maxSize={4}
/>
</div>Props
| Prop | Type | Default | Description |
|---|---|---|---|
background | string | "#0d47a1" | Background color of the canvas container |
particleColor | string | "#ffffff" | Color of the particles: a hex string, or currentColor to follow the text colour |
minSize | number | 1 | Minimum particle radius in pixels |
maxSize | number | 3 | Maximum particle radius in pixels |
speed | number | 4 | Particle speed multiplier |
particleDensity | number | 120 | Number of particles |
Links
Related components
FallingStarsBg
Canvas-based 3D starfield with perspective projection, motion trails, and glow
Backgrounds Fancy
FlickeringGrid
Canvas grid of squares that flicker in and out of opacity at random each frame, pausing automatically via IntersectionObserver when scrolled off-screen and resizing to fit its container via ResizeObserver
Backgrounds Fancy
MatrixRain
Canvas-based falling glyph rain with configurable color, speed, and density
Backgrounds Fancy