All components

Card Flip Hover

Card Flip Hover is a React and Tailwind CSS card component from Eldora UI, licensed MIT. Copy it and paste it into your project.

Eldora UI MIT cards

What it is

Card Flip Hover is a React and Tailwind CSS card component from Eldora UI, 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 react

Licence

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

Card Flip Hover

registry/eldoraui/card-flip-hover.tsx
"use client"

import React, { useState } from "react"

interface CardFlipHoverProps {
  imageUrl: string
}

export const CardFlipHover = ({ imageUrl }: CardFlipHoverProps) => {
  const [isFlipped, setIsFlipped] = useState(false)

  const handleHover = () => {
    if (!isFlipped) {
      setIsFlipped(true)
      setTimeout(() => setIsFlipped(false), 700)
    }
  }

  return (
    <div className="h-60 w-44 [perspective:1000px]" onMouseEnter={handleHover}>
      <div
        className={`relative h-full w-full transition-all duration-700 [transform-style:preserve-3d] ${
          isFlipped
            ? "[transform:rotateY(180deg)_translateY(-40px)]"
            : "[transform:rotateY(0deg)_translateY(0px)]"
        }`}
      >
        {/* Front Side */}
        <div className="absolute h-full w-full overflow-hidden rounded-xl shadow-xl [backface-visibility:hidden]">
          <img
            src={imageUrl}
            alt="Front"
            className="h-full w-full object-cover"
          />
        </div>

        {/* Back Side */}
        <div className="absolute flex h-full w-full [transform:rotateY(180deg)] items-center justify-center overflow-hidden rounded-xl bg-cyan-600 text-xl font-bold text-white shadow-xl [backface-visibility:hidden]">
          <img
            src={imageUrl}
            alt="Back"
            className="h-full w-full object-cover"
          />
        </div>
      </div>
    </div>
  )
}

Similar components