Shadcnspace Builder
componentanimated-text-05source: ok · refreshed
Animated Text-05 - Shimmer Text
Animated Shimmer Text component
npx shadcn add "https://builder.shadcnspace.com/r/animated-text-05.json"free
No selection tags yet — empty means no evidence, not lack of support.
Files1 · source cached 10/3/2026, 12:41:16 AM
src/components/shadcn-space/animated-text/animated-text-05.tsx
"use client";
import { useEffect, useState } from "react";
import { type JSX } from "react";
import { motion, Transition } from "motion/react";
import { cn } from "@/lib/utils";
type TextShimmerWaveProps = {
children: string;
as?: React.ElementType;
className?: string;
duration?: number;
zDistance?: number;
xDistance?: number;
yDistance?: number;
spread?: number;
scaleDistance?: number;
rotateYDistance?: number;
transition?: Transition;
};
function TextShimmerWave({
children,
as: Component = "p",
className,
duration = 1,
zDistance = 10,
xDistance = 2,
yDistance = -2,
spread = 1,
scaleDistance = 1.1,
rotateYDistance = 10,
transition,
}: TextShimmerWaveProps) {
const MotionComponent = motion.create(
Component as keyof JSX.IntrinsicElements,
);
// Track dark mode based on <html> class
const [isDark, setIsDark] = useState(false);
useEffect(() => {
setIsDark(document.documentElement.classList.contains("dark"));
const observer = new MutationObserver(() => {
setIsDark(document.documentElement.classList.contains("dark"));
});
observer.observe(document.documentElement, {
attributes: true,
attributeFilter: ["class"],
});
return () => observer.disconnect();
}, []);
// Colors based on theme
const baseColor = isDark ? "#71717a" : "#a1a1aa";
const gradientColor = isDark ? "#ffffff" : "#000000";
return (
<MotionComponent
className={cn("relative inline-block [perspective:500px]", className)}
style={{ color: baseColor }}
>
{children.split("").map((char, i) => {
const delay = (i * duration * (1 / spread)) / children.length;
return (
<motion.span
key={`${char}-${i}-${isDark}`} // remounts span when theme changes
className="inline-block whitespace-pre [transform-style:preserve-3d] text-xl sm:text-2xl"
initial={{
translateZ: 0,
scale: 1,
rotateY: 0,
color: baseColor,
}}
animate={{
translateZ: [0, zDistance, 0],
translateX: [0, xDistance, 0],
translateY: [0, yDistance, 0],
scale: [1, scaleDistance, 1],
rotateY: [0, rotateYDistance, 0],
color: [baseColor, gradientColor, baseColor],
}}
transition={{
duration,
repeat: Infinity,
repeatDelay: (children.length * 0.05) / spread,
delay,
ease: "easeInOut",
...transition,
}}
>
{char}
</motion.span>
);
})}
</MotionComponent>
);
}
export default function TextShimmerMotion() {
return (
<TextShimmerWave
duration={1}
spread={1}
zDistance={1}
scaleDistance={1.1}
rotateYDistance={20}
>
Tailwind Admin generating your table...
</TextShimmerWave>
);
}
More from Shadcnspace Builder
About Us 01 - Impact MetricsblockAccordion-01 - DefaultcomponentAccordion-02 - Multi-levelcomponentAnimated Text-01 - Shiny TextcomponentAnimated Text-02 - Gradient TextcomponentAnimated Text-03 - TypingcomponentAnimated Text-04 - Rolling Textcomponent
Browse all components in this library →