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 rainbow button to pass in classname

Dillion Verma33b206763733
diff --git a/content/docs/components/rainbow-button.mdx b/content/docs/components/rainbow-button.mdx
index 336d87e2..6d40caba 100644
--- a/content/docs/components/rainbow-button.mdx
+++ b/content/docs/components/rainbow-button.mdx
@@ -86,6 +86,7 @@ module.exports = {
## Props
-| Prop | Type | Description |
-| -------- | --------------- | ---------------------------------------------- |
-| children | React.ReactNode | The content to be displayed inside the button. |
+| Prop | Type | Description |
+| --------- | --------------- | --------------------------------------------------- |
+| children | React.ReactNode | The content to be displayed inside the button. |
+| className | string | Additional CSS classes to be applied to the button. |
diff --git a/registry/default/magicui/rainbow-button.tsx b/registry/default/magicui/rainbow-button.tsx
index fefdc503..e6453d6a 100644
--- a/registry/default/magicui/rainbow-button.tsx
+++ b/registry/default/magicui/rainbow-button.tsx
@@ -5,21 +5,28 @@ import { cn } from "@/lib/utils";
interface RainbowButtonProps
extends React.ButtonHTMLAttributes<HTMLButtonElement> {}
-export function RainbowButton({ children, ...props }: RainbowButtonProps) {
+export function RainbowButton({
+ children,
+ className,
+ ...props
+}: RainbowButtonProps) {
return (
<button
- className={cn(
- "h-11 px-8 py-2 inline-flex items-center justify-center rounded-xl font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 relative group animate-rainbow cursor-pointer border-0 bg-[length:200%] text-primary-foreground [background-clip:padding-box,border-box,border-box] [background-origin:border-box] [border:calc(0.08*1rem)_solid_transparent]",
+ className={
+ (cn(
+ "group relative inline-flex h-11 animate-rainbow cursor-pointer items-center justify-center rounded-xl border-0 bg-[length:200%] px-8 py-2 font-medium text-primary-foreground transition-colors [background-clip:padding-box,border-box,border-box] [background-origin:border-box] [border:calc(0.08*1rem)_solid_transparent] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",
- // before styles
- "before:absolute before:bottom-[-20%] before:left-1/2 before:z-0 before:h-1/5 before:w-3/5 before:-translate-x-1/2 before:animate-rainbow before:bg-[linear-gradient(90deg,hsl(var(--color-1)),hsl(var(--color-5)),hsl(var(--color-3)),hsl(var(--color-4)),hsl(var(--color-2)))] before:bg-[length:200%] before:[filter:blur(calc(0.8*1rem))]",
+ // before styles
+ "before:absolute before:bottom-[-20%] before:left-1/2 before:z-0 before:h-1/5 before:w-3/5 before:-translate-x-1/2 before:animate-rainbow before:bg-[linear-gradient(90deg,hsl(var(--color-1)),hsl(var(--color-5)),hsl(var(--color-3)),hsl(var(--color-4)),hsl(var(--color-2)))] before:bg-[length:200%] before:[filter:blur(calc(0.8*1rem))]",
- // light mode colors
- "bg-[linear-gradient(#121213,#121213),linear-gradient(#121213_50%,rgba(18,18,19,0.6)_80%,rgba(18,18,19,0)),linear-gradient(90deg,hsl(var(--color-1)),hsl(var(--color-5)),hsl(var(--color-3)),hsl(var(--color-4)),hsl(var(--color-2)))]",
+ // light mode colors
+ "bg-[linear-gradient(#121213,#121213),linear-gradient(#121213_50%,rgba(18,18,19,0.6)_80%,rgba(18,18,19,0)),linear-gradient(90deg,hsl(var(--color-1)),hsl(var(--color-5)),hsl(var(--color-3)),hsl(var(--color-4)),hsl(var(--color-2)))]",
- // dark mode colors
- " dark:bg-[linear-gradient(#fff,#fff),linear-gradient(#fff_50%,rgba(255,255,255,0.6)_80%,rgba(0,0,0,0)),linear-gradient(90deg,hsl(var(--color-1)),hsl(var(--color-5)),hsl(var(--color-3)),hsl(var(--color-4)),hsl(var(--color-2)))]",
- )}
+ // dark mode colors
+ "dark:bg-[linear-gradient(#fff,#fff),linear-gradient(#fff_50%,rgba(255,255,255,0.6)_80%,rgba(0,0,0,0)),linear-gradient(90deg,hsl(var(--color-1)),hsl(var(--color-5)),hsl(var(--color-3)),hsl(var(--color-4)),hsl(var(--color-2)))]"
+ ),
+ className)
+ }
{...props}
>
{children}