Loading...
Installation
Copy and paste the following code into your project.
components/eldoraui/interactivebutton.tsx
import React from "react";
import { ArrowRight } from "lucide-react";
interface InteractiveHoverButtonProps {
text?: string;
className?: string;
}
export function InteractiveHoverButton({
text = "Button",
className,
}: InteractiveHoverButtonProps = {}) {
return (
<div
className={`group relative w-32 cursor-pointer overflow-hidden rounded-full border bg-white p-2 text-center font-semibold text-black ${className}`}
>
<span className="inline-block translate-x-1 transition-all duration-300 group-hover:translate-x-12 group-hover:opacity-0">
{text}
</span>
<div className="absolute top-0 z-10 flex h-full w-full translate-x-12 items-center justify-center gap-2 text-white opacity-0 transition-all duration-300 group-hover:-translate-x-1 group-hover:opacity-100">
<span>{text}</span>
<ArrowRight />
</div>
<div className="absolute left-[20%] top-[40%] h-2 w-2 scale-[1] rounded-lg bg-black transition-all duration-300 group-hover:left-[0%] group-hover:top-[0%] group-hover:h-full group-hover:w-full group-hover:scale-[1.8] group-hover:bg-fuchsia-500 dark:group-hover:bg-fuchsia-700"></div>
</div>
);
}
Update the import paths to match your project setup.
Props
Prop | Type | Description | Default |
---|---|---|---|
text | string | The text to be displayed inside the button | Button |
className | string | Additional class names to style the component | Undefined |