Skip to content

UI Library for Design Engineers. Animated components and effects you can copy and paste into your apps. Free. Open Source.

Add support for emoji and text character particles (#638)

Erik Nilsson293ab62746ed
diff --git a/registry/magicui/cool-mode.tsx b/registry/magicui/cool-mode.tsx
index 4f8f09ac..085c1555 100644
--- a/registry/magicui/cool-mode.tsx
+++ b/registry/magicui/cool-mode.tsx
@@ -99,8 +99,12 @@ const applyParticleEffect = (
circleSVG.setAttribute("height", size.toString());
particle.appendChild(circleSVG);
- } else {
+ } else if (particleType.startsWith("http") || particleType.startsWith("/")) {
+ // Handle URL-based images
particle.innerHTML = `<img src="${particleType}" width="${size}" height="${size}" style="border-radius: 50%">`;
+ } else {
+ // Handle emoji or text characters
+ particle.innerHTML = `<div style="font-size: ${size}px; line-height: 1; text-align: center; width: ${size}px; height: ${size}px;">${particleType}</div>`;
}
particle.style.position = "absolute";