About
Row of covers that turn in 3D as you scroll, inspired by Cover Flow on iOS 6. From chanhdai.com (ncdai), MIT.
Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Cover Flow to your project and fits it to your theme.
Code
How Cover Flow is used: the demo's code. The component's own source comes with a free account.
Usage.tsx
"use client"
import { useState } from "react"
import { CoverFlow, CoverFlowCover, CoverFlowItem, CoverFlowReflection } from "@/components/ui/chanhdai-cover-flow"
export default function CoverFlowDemo() {
const [value, setValue] = useState(PHOTOS[3].id)
const selected = PHOTOS.find((photo) => photo.id === value)
return (
<div className="relative w-full">
<CoverFlow
value={value}
onValueChange={setValue}
aria-label="Photos of Vietnam"
className="[--cover-flow-size:--spacing(40)] sm:[--cover-flow-size:--spacing(56)]"
>
{PHOTOS.map((photo) => (
<CoverFlowItem key={photo.id} value={photo.id}>
<CoverFlowCover>
<img src={photo.src} alt={`${photo.title}, ${photo.place}`} />
<CoverFlowReflection>
<img src={photo.src} alt="" />
</CoverFlowReflection>
</CoverFlowCover>
</CoverFlowItem>
))}
</CoverFlow>
{/* Sits over the reflection's fade, where the covers leave room */}
<p className="pointer-events-none absolute inset-x-0 bottom-2 flex flex-col items-center px-4 text-center text-sm sm:bottom-4">
<span className="max-w-full truncate font-medium">
{selected?.title}
</span>
<span className="max-w-full truncate text-muted-foreground">
{selected?.place}
</span>
</p>
</div>
)
}
const PHOTOS = [
{
id: "ha-long-bay",
title: "Ha Long Bay",
place: "Quang Ninh",
src: "https://cdn.21st.dev/assets/mirror/fa/fab2b74669d8526a2c2c2fbc44628a771d33023a6d611369ef7b2227fed97039.webp",
},
{
id: "tra-su-forest",
title: "Tra Su Forest",
place: "An Giang",
src: "https://cdn.21st.dev/assets/mirror/95/953a5f351c499eb897d60d648a9c59671cb6a767a91ff2d5969bfbb2fed684fd.webp",
},
{
id: "trang-an",
title: "Trang An",
place: "Ninh Binh",
src: "https://cdn.21st.dev/assets/mirror/91/9111fdaa776a76ae18a762c7cc24886c3cbdebc89a616466f013afd599016329.webp",
},
{
id: "saigon-river",
title: "Saigon River",
place: "Ho Chi Minh City",
src: "https://cdn.21st.dev/assets/mirror/9c/9c3cde1f4b4bd09c278e1226706d07ff712dae011cc8fa6d7ebf3a40534f7259.webp",
},
{
id: "bai-dinh-pagoda",
title: "Bai Dinh Pagoda",
place: "Ninh Binh",
src: "https://cdn.21st.dev/assets/mirror/c8/c8695fd0d0f1f9f8100aa7dad71491d59afb35a1c76e5a58f0b896f96f2e551a.webp",
},
{
id: "imperial-city",
title: "Imperial City",
place: "Hue",
src: "https://cdn.21st.dev/assets/mirror/a3/a34c4f98782a19e3d40f2f61e43221d3595bb2ac0d6cd8326c1808ba0e8ed6e2.webp",
},
{
id: "dragon-bridge",
title: "Dragon Bridge",
place: "Da Nang",
src: "https://cdn.21st.dev/assets/mirror/24/241ab7b58d63a39e108ee06298f2c37faa530f483272660c2c9f02bf127efdf3.webp",
},
]








