Docs
Hover Dev Cards
Hover.dev Cards are interactive cards with dynamic hover effects and smooth animations.
Installation
Install dependencies
npm install framer-motion lucide-react
Run the following command
It will create a new file hover-dev-cards.tsx
inside the components/mage-ui/card
directory.
mkdir -p components/mage-ui/card && touch components/mage-ui/card/hover-dev-cards.tsx
Paste the code
Open the newly created file and paste the following code:
"use client";
import React from "react";
import { IconType } from "react-icons";
import { FiCreditCard, FiMail, FiUser, FiUsers } from "react-icons/fi";
const HoverDevCards = () => {
return (
<div className="p-4">
<p className="text-xl font-semibold mb-2">Settings</p>
<div className="grid gap-4 grid-cols-2 lg:grid-cols-4">
<Card
title="Account"
subtitle="Manage profile"
href="#"
Icon={FiUser}
/>
<Card title="Email" subtitle="Manage email" href="#" Icon={FiMail} />
<Card title="Team" subtitle="Manage team" href="#" Icon={FiUsers} />
<Card
title="Billing"
subtitle="Manage cards"
href="#"
Icon={FiCreditCard}
/>
</div>
</div>
);
};
interface CardType {
title: string;
subtitle: string;
Icon: IconType;
href: string;
}
const Card = ({ title, subtitle, Icon, href }: CardType) => {
return (
<a
href={href}
className="w-[30vw] h-[50vh] p-4 rounded border-[1px] border-slate-300 relative overflow-hidden group bg-white"
>
<div className="absolute inset-0 bg-gradient-to-r from-violet-600 to-indigo-600 translate-y-[100%] group-hover:translate-y-[0%] transition-transform duration-300" />
<Icon className="absolute z-10 -top-12 -right-12 text-9xl text-slate-100 group-hover:text-violet-400 group-hover:rotate-12 transition-transform duration-300" />
<Icon className="mb-2 text-2xl text-violet-600 group-hover:text-white transition-colors relative z-10 duration-300" />
<h3 className="font-medium text-lg text-slate-950 group-hover:text-white relative z-10 duration-300">
{title}
</h3>
<p className="text-slate-400 group-hover:text-violet-200 relative z-10 duration-300">
{subtitle}
</p>
</a>
);
};
export default HoverDevCards;