A captivating button component featuring a shimmering light that travels around the perimeter.
Installation
npx shadcn@latest add @magicui/shimmer-button
Required CSS
Add these animations to your global CSS:
@theme inline {
--animate-shimmer-slide: shimmer-slide var(--speed) ease-in-out infinite alternate;
--animate-spin-around: spin-around calc(var(--speed) * 2) infinite linear;
@keyframes shimmer-slide {
to {
transform: translate(calc(100cqw - 100%), 0);
}
}
@keyframes spin-around {
0% {
transform: translateZ(0) rotate(0);
}
15%, 35% {
transform: translateZ(0) rotate(90deg);
}
65%, 85% {
transform: translateZ(0) rotate(270deg);
}
100% {
transform: translateZ(0) rotate(360deg);
}
}
}
import { ShimmerButton } from "@/components/ui/shimmer-button"
export default function Example() {
return <ShimmerButton>Click me</ShimmerButton>
}
shimmerColor
string
default:"'#ffffff'"
Color of the shimmering light effect
Size of the shimmer effect
Border radius of the button
Duration of the shimmer animation
background
string
default:"'rgba(0, 0, 0, 1)'"
Background color of the button
Additional CSS classes to apply
Features
- Animated shimmer border effect
- Customizable colors and timing
- Smooth hover interactions
- Active state with press feedback
- Fully customizable with Tailwind CSS
Credits
Inspired by @jh3yy