Skip to content

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

fix: add the missing className props #173 (#205)

Abderrahman ES-SEBYITYa15e5e8c715e
diff --git a/content/docs/components/shiny-button.mdx b/content/docs/components/shiny-button.mdx
index a9b45b14..6e426fda 100644
--- a/content/docs/components/shiny-button.mdx
+++ b/content/docs/components/shiny-button.mdx
@@ -45,6 +45,7 @@ npx magicui-cli add shiny-button
| Prop | Type | Description | Default |
| ---- | ------ | ------------------- | -------------- |
| text | string | The text to display | "shiny button" |
+| className | string | The class name to be applied to the component | |
## Credits
diff --git a/registry/components/example/shiny-button-demo.tsx b/registry/components/example/shiny-button-demo.tsx
index 3ff06894..e6c603df 100644
--- a/registry/components/example/shiny-button-demo.tsx
+++ b/registry/components/example/shiny-button-demo.tsx
@@ -1,5 +1,5 @@
import ShinyButton from "@/components/magicui/shiny-button";
export default function ShinyButtonDemo() {
- return <ShinyButton text="Shiny Button" />;
+ return <ShinyButton text="Shiny Button" className="" />;
}
diff --git a/registry/components/magicui/shiny-button.tsx b/registry/components/magicui/shiny-button.tsx
index f79ba098..e1f13395 100644
--- a/registry/components/magicui/shiny-button.tsx
+++ b/registry/components/magicui/shiny-button.tsx
@@ -2,6 +2,8 @@
import { motion, type AnimationProps } from "framer-motion";
+import { cn } from "@/lib/utils";
+
const animationProps = {
initial: { "--x": "100%", scale: 0.8 },
animate: { "--x": "-100%", scale: 1 },
@@ -22,12 +24,21 @@ const animationProps = {
},
},
} as AnimationProps;
-
-const ShinyButton = ({ text = "shiny-button" }) => {
+interface ShinyButtonProps {
+ text: string;
+ className?: string;
+}
+const ShinyButton = ({
+ text = "shiny-button",
+ className,
+}: ShinyButtonProps) => {
return (
<motion.button
{...animationProps}
- className="relative rounded-lg px-6 py-2 font-medium backdrop-blur-xl transition-[box-shadow] duration-300 ease-in-out hover:shadow dark:bg-[radial-gradient(circle_at_50%_0%,hsl(var(--primary)/10%)_0%,transparent_60%)] dark:hover:shadow-[0_0_20px_hsl(var(--primary)/10%)]"
+ className={cn(
+ "relative rounded-lg px-6 py-2 font-medium backdrop-blur-xl transition-[box-shadow] duration-300 ease-in-out hover:shadow dark:bg-[radial-gradient(circle_at_50%_0%,hsl(var(--primary)/10%)_0%,transparent_60%)] dark:hover:shadow-[0_0_20px_hsl(var(--primary)/10%)]",
+ className,
+ )}
>
<span
className="relative block h-full w-full text-sm uppercase tracking-wide text-[rgb(0,0,0,65%)] dark:font-light dark:text-[rgb(255,255,255,90%)]"