Skip to content

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

🐛 fix: update shimmer button styles

Dillion Verma04d8b2d5d383
diff --git a/components/component-preview.tsx b/components/component-preview.tsx
index 509d922b..be43f9e2 100644
--- a/components/component-preview.tsx
+++ b/components/component-preview.tsx
@@ -40,7 +40,7 @@ export function ComponentPreview({
return (
<div
- className={cn("group relative my-4 flex flex-col space-y-2", className)}
+ className={cn("relative my-4 flex flex-col space-y-2", className)}
{...props}
>
<Tabs defaultValue="preview" className="relative mr-auto w-full">
diff --git a/registry/components/example/shimmer-button-demo.tsx b/registry/components/example/shimmer-button-demo.tsx
index b95d8e8a..63d48a60 100644
--- a/registry/components/example/shimmer-button-demo.tsx
+++ b/registry/components/example/shimmer-button-demo.tsx
@@ -5,7 +5,7 @@ export default function ShimmerButtonDemo() {
return (
<div className="relative flex h-full w-full items-center justify-center rounded-lg border bg-background py-20 shadow-2xl">
<ShimmerButton>
- <span className="whitespace-pre-wrap bg-gradient-to-b from-black from-30% to-gray-300/80 bg-clip-text text-center text-sm font-semibold leading-none tracking-tight text-white dark:from-white dark:to-slate-900/10 dark:text-transparent lg:text-2xl">
+ <span className="whitespace-pre-wrap text-center text-sm font-medium leading-none tracking-tight text-white dark:from-white dark:to-slate-900/10 lg:text-lg">
Shimmer Button
</span>
</ShimmerButton>
diff --git a/registry/components/magicui/shimmer-button.tsx b/registry/components/magicui/shimmer-button.tsx
index e04179a0..814d3a06 100644
--- a/registry/components/magicui/shimmer-button.tsx
+++ b/registry/components/magicui/shimmer-button.tsx
@@ -20,7 +20,7 @@ const ShimmerButton = React.forwardRef<HTMLButtonElement, ShimmerButtonProps>(
shimmerSize = "0.1em",
shimmerDuration = "1.5s",
borderRadius = "100px",
- background = "radial-gradient(ellipse 80% 50% at 50% 120%,rgba(62, 61, 117),rgba(18, 18, 38))",
+ background = "rgba(18, 18, 38)",
className,
children,
...props
@@ -40,15 +40,20 @@ const ShimmerButton = React.forwardRef<HTMLButtonElement, ShimmerButtonProps>(
} as CSSProperties
}
className={cn(
- "group relative z-0 cursor-pointer overflow-hidden whitespace-nowrap px-6 py-4 [background:var(--bg)] [border-radius:var(--radius)] ",
- "transition-all duration-300 ease-in-out hover:scale-105 hover:shadow-[0_0_20px_10px_rgba(62,61,117,0.5)]",
+ "group relative z-0 flex cursor-pointer items-center justify-center overflow-hidden whitespace-nowrap px-6 py-4 text-white [background:var(--bg)] [border-radius:var(--radius)] dark:text-black",
className,
)}
ref={ref}
{...props}
>
{/* spark container */}
- <div className="absolute inset-0 -z-30 overflow-visible [container-type:size]">
+ <div
+ className={cn(
+ "blur-lg",
+ "-z-30",
+ "absolute inset-0 overflow-visible border border-white [container-type:size]",
+ )}
+ >
{/* spark */}
<div className="absolute inset-0 h-[100cqh] animate-slide [aspect-ratio:1] [border-radius:0] [mask:none] ">
{/* spark before */}
@@ -56,13 +61,17 @@ const ShimmerButton = React.forwardRef<HTMLButtonElement, ShimmerButtonProps>(
</div>
</div>
- {/* content */}
- <div className="pointer-events-none relative z-10 text-white dark:text-black">
- {children}
- </div>
+ {children}
+
+ {/* Highlight */}
+ <div className="absolute bottom-0 left-1/2 h-2/5 w-3/4 -translate-x-1/2 rounded-full bg-white/10 opacity-50 blur-lg transition-all duration-300 ease-in-out group-hover:h-3/5 group-hover:opacity-100"></div>
{/* backdrop */}
- <div className="absolute -z-20 [background:var(--bg)] [border-radius:var(--radius)] [inset:var(--cut)]" />
+ <div
+ className={cn(
+ "absolute -z-20 [background:var(--bg)] [border-radius:var(--radius)] [inset:var(--cut)]",
+ )}
+ />
</button>
);
},