Loading preview
Animated Card
CardsA card that tilts in 3D toward the pointer with spring physics.
A folder that opens on hover and fans out the photos inside it.
npx shadcn@latest add @venusui/photo-folderRun this in a project set up with shadcn. If you haven’t set it up yet, run npx shadcn@latest init first.
Paths use the default shadcn aliases. The CLI follows the aliases in your components.json.
@/components/ui/photo-folder.tsxThe code behind the preview above.
photo-folder-demo.tsx
import { PhotoFolder } from "@/components/ui/photo-folder"
// Photos: Unsplash (free under the Unsplash License).
const photo = (id: string) => `https://images.unsplash.com/photo-${id}?w=480&h=600&fit=crop&auto=format&q=75`
const FOLDERS = [
{
label: "Japan",
color: "oklch(0.7 0.14 245)",
images: [
{ src: photo("1493976040374-85c8e12f0c0e"), alt: "A pagoda at the end of an old street in Kyoto at dusk" },
{ src: photo("1478436127897-769e1b3f0f36"), alt: "A tunnel of red torii gates" },
{ src: photo("1490806843957-31f4c9a91c65"), alt: "Mount Fuji framed by cherry blossoms" },
],
},
{
label: "Up north",
color: "oklch(0.74 0.13 160)",
images: [
{ src: photo("1476610182048-b716b8518aae"), alt: "A waterfall over green cliffs at sunset" },
{ src: photo("1531366936337-7c912a4589a7"), alt: "Green and purple northern lights over snow" },
{ src: photo("1504893524553-b855bce32c67"), alt: "A river winding through a mossy canyon" },
],
},
{
label: "Tokyo nights",
color: "oklch(0.68 0.16 300)",
images: [
{ src: photo("1528360983277-13d401cdc186"), alt: "A red paper lantern in a narrow alley at night" },
{ src: photo("1540959733332-eab4deabeeaf"), alt: "A neon-lit shopping street full of people" },
{ src: photo("1513407030348-c983a97b98d8"), alt: "Tokyo Tower above the city at twilight" },
],
},
]
export default function PhotoFolderDemo() {
return (
<div className="flex flex-wrap items-end justify-center gap-x-6 gap-y-14 pt-28">
{FOLDERS.map((folder) => (
<PhotoFolder key={folder.label} {...folder} className="w-44 sm:w-52" />
))}
</div>
)
}
| Prop | Type | Default | Description |
|---|---|---|---|
| images | { src: string; alt: string }[] | — | Photos in the folder. Up to five fan out; the count includes all of them. |
| label | string | — | Folder name, shown under it and used as its accessible name. |
| description | string | — | Second line under the name. Defaults to the number of photos. |
| color | string | oklch(0.7 0.14 245) | Folder color: any CSS color. The back and the lighter top of the flap are mixed from it. |
| open | boolean | — | Controlled open state. Leave unset to open on hover and toggle on click. |
| onOpenChange | (open: boolean) => void | — | Called when hovering or clicking opens or closes the folder. |
All <button> props except children, e.g. onClick to open a gallery.
className="w-44"; the folder keeps a 5:4 shape.onClick (or wrap your own logic around open) to open a full gallery when the folder is clicked.aria-expanded, named after the folder and its photo count; the photos’ alt texts are its description.overflow-hidden, or there’s too little space above the folder. Add top padding or margin.Unknown registry "@venusui"npx shadcn@latest), install by URL, or register it with its address: npx shadcn@latest registry add @venusui=https://venusui.com/r/{name}.json.No components.json foundnpx shadcn@latest init in your project first.A card that tilts in 3D toward the pointer with spring physics.
Stacked cards with the next ones peeking out; Next sends the top card to the back.
A sealed envelope that opens on hover or click: the flap folds back and the letter slides out.