Componentdata0.64 KB gzipZero dependencies

Flip Card

Two-face card with rotateY flip animation, hover or click trigger.

Preview

Live Preview
Open ↗

Installation

Tokens guide →

Add to your project via CLI (zero dependencies, code you own):

npx bigbullui add flip-card

Or install the full npm package:

npm install bigbullui

Usage

tsx3 lines
import { FlipCard } from "@/components/ui/flip-card"; <FlipCard />

Source code

flip-card.tsx + 1 helper

Zero third-party dependencies (2 local files shown in tabs below).

tsxflip-card.tsx51 lines
"use client"; import * as React from "react";import { cn } from "./lib/utils"; export interface FlipCardProps extends React.HTMLAttributes<HTMLDivElement> {  front: React.ReactNode;  back: React.ReactNode;  /** Flip trigger: hover or click */  trigger?: "hover" | "click";} /** Two-sided flip card: rotateY 180, 3D perspective, hidden backface. */export function FlipCard({ front, back, trigger = "click", className, ...props }: FlipCardProps) {  const [flipped, setFlipped] = React.useState(false);   const toggle = () => {    if (trigger === "click") setFlipped((f) => !f);

Props

Interactive Prop Playground

Tweak parsed AST props below to generate ready-to-paste JSX.

tsx3 lines
import { FlipCard } from "@/components/ui/flip-card"; <FlipCard />
PropTypeDescription
frontReact.ReactNodeConfigures front.
backReact.ReactNodeConfigures back.
trigger"hover" | "click"Flip trigger: hover or click