All components

Productcard4

Productcard4 is a React and Tailwind CSS card component from UI Layouts, licensed MIT. Copy it and paste it into your project.

UI Layouts MIT cards

What it is

Productcard4 is a React and Tailwind CSS card component from UI Layouts, licensed MIT. Copy it and paste it into your project.

How to use it

Open it in the catalogue, press copy, and paste it into your project. The prompt you copy carries the code and the rules that tell your agent to reproduce it without changing anything.

Open in the catalogue

Five free copies a month. No card.

Needs

npm i motion

Licence

This component comes from UI Layouts and is redistributed under the MIT licence, which permits commercial use. The copyright notice travels with the code.

Productcard4

./registry/components/card/product-card4.tsx
'use client';
import { Heart } from 'lucide-react';
import { motion } from 'motion/react';
import Image from 'next/image';
import React, { useState } from 'react';

function Card2() {
  const [isActive, setIsActive] = useState(false);

  const handleClick = () => {
    setIsActive((prevState) => !prevState);
  };

  return (
    <div className='w-[350px] mx-auto '>
      <div className='dark:bg-white bg-neutral-50 border dark:border-none  rounded-2xl'>
        <div className='w-full h-56 relative'>
          <motion.button
            className='absolute top-2 right-3 z-20 text-2xl text-white'
            onClick={handleClick}
            animate={{ scale: isActive ? 1.2 : 1 }}
            transition={{ type: 'spring', stiffness: 1000, damping: 10 }}
          >
            {isActive ? (
              <>
                <Heart className=' fill-white' />
              </>
            ) : (
              <>
                <Heart />
              </>
            )}
          </motion.button>
          <Image
            src={
              'https://images.unsplash.com/photo-1605733160314-4fc7dac4bb16?q=80&w=2090&auto=format&fit=crop'
            }
            alt='shoes'
            width={1000}
            height={1000}
            className={`h-56 w-full rounded-2xl object-cover `}
          />
        </div>
        <article className='text-black space-y-2 p-2 pb-3'>
          <div className='flex justify-between'>
            <h1 className='font-semibold text-xl text-primary-dark'>Nike Air Max</h1>
            <span className='font-medium text-xl text-primary-dark'>$394</span>
          </div>
          <p className='text-xs  text-black'>Lorem ipsum, dolor sit amet consectetur adipisicing</p>

          <button className='w-full hover:text-white flex justify-center items-center gap-2 border-black border-2 text-black hover:bg-linear-to-r dark:from-[#070e41] dark:to-[#263381] from-[#3e5068] to-[#0c1970] py-2  rounded-md'>
            Add to cart
          </button>
        </article>
      </div>
    </div>
  );
}

export default Card2;

Similar components