Eduardo Calvo

Folder Reveal

Cards

About

A desktop-style folder whose flap tilts back and fans out the files inside: hover or click, controlled or not, five colours, any content per card. Respects prefers-reduced-motion.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Folder Reveal to your project and fits it to your theme.

Code

How Folder Reveal 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 Component, { type FolderRevealItem } from "@/components/ui/folder-reveal";

type FileSpec = {
  accent: string;
  id: string;
  lines: number[];
  name: string;
  size: string;
};

const FileCard = ({ accent, lines, name, size }: Omit<FileSpec, "id">) => (
  <div className="flex h-full flex-col bg-card">
    <div className={`h-1.5 w-full ${accent}`} />
    <div className="flex flex-1 flex-col gap-1.5 p-2.5">
      {lines.map((width, index) => (
        <div
          className="h-[3px] rounded-full bg-foreground/15"
          key={`${name}-line-${index}`}
          style={{ width: `${width}%` }}
        />
      ))}
    </div>
    <div className="border-t bg-muted px-2.5 py-1.5">
      <p className="truncate font-medium text-[10px] text-foreground leading-tight">
        {name}
      </p>
      <p className="text-[9px] text-muted-foreground tabular-nums">{size}</p>
    </div>
  </div>
);

const toItems = (files: FileSpec[]): FolderRevealItem[] =>
  files.map(({ id, ...file }) => ({ content: <FileCard {...file} />, id }));

const invoices: FileSpec[] = [
  { accent: "bg-emerald-500", id: "q1", lines: [90, 74, 82, 58], name: "Invoice Q1.pdf", size: "248 KB" },
  { accent: "bg-emerald-500", id: "q2", lines: [86, 62, 78, 70], name: "Invoice Q2.pdf", size: "312 KB" },
  { accent: "bg-lime-500", id: "receipts", lines: [72, 88, 54, 80], name: "Receipts.xlsx", size: "1.2 MB" },
];

const brand: FileSpec[] = [
  { accent: "bg-pink-500", id: "logo", lines: [64, 88, 46], name: "Logo marks.fig", size: "4.8 MB" },
  { accent: "bg-fuchsia-500", id: "type", lines: [92, 70, 84, 60], name: "Typography.pdf", size: "820 KB" },
  { accent: "bg-rose-500", id: "guide", lines: [78, 86, 62, 74], name: "Guidelines.md", size: "36 KB" },
];

const photos: FileSpec[] = [
  { accent: "bg-sky-500", id: "s1", lines: [88, 66, 78], name: "Shoot 01.raw", size: "24.6 MB" },
  { accent: "bg-blue-500", id: "s2", lines: [72, 90, 58, 66], name: "Shoot 02.raw", size: "22.1 MB" },
  { accent: "bg-cyan-500", id: "sel", lines: [84, 60, 90], name: "Selects.zip", size: "108 MB" },
];

export default function DemoOne() {
  const [invoicesOpen, setInvoicesOpen] = useState(false);
  const [brandOpen, setBrandOpen] = useState(true);
  const [photosOpen, setPhotosOpen] = useState(true);

  return (
    <div className="flex min-h-[560px] w-full flex-wrap items-end justify-center gap-6 bg-background px-4 pt-32 pb-12">
      <Component
        items={toItems(invoices)}
        label="Invoices"
        onOpenChange={setInvoicesOpen}
        open={invoicesOpen}
        size={360}
        trigger="click"
      />
      <Component
        color="brand"
        items={toItems(brand)}
        label="Brand"
        onOpenChange={setBrandOpen}
        open={brandOpen}
        size={360}
        trigger="click"
      />
      <Component
        color="blue"
        items={toItems(photos)}
        label="Photos"
        onOpenChange={setPhotosOpen}
        open={photosOpen}
        rotation={9}
        size={360}
        spread={58}
        trigger="click"
      />
    </div>
  );
}

Dependencies

More by Eduardo Calvo

View all
  • Scrollable Card Stack

    Scrollable Card Stack

    301
  • Pixel Flow Field

    Pixel Flow Field

    222
  • Siri Orb

    Siri Orb

    204
  • AI Task List

    AI Task List

    203
  • Gravity Stars

    Gravity Stars

    186
  • Cursor Follow

    Cursor Follow

    164
  • Coverflow Carousel

    Coverflow Carousel

    161
  • Agent Avatar

    Agent Avatar

    161

More in Cards

View all
  • Course Design Cards

    Course Design Cards

    1.4K
  • Statistics Card 2

    Statistics Card 2

    322
  • Card

    Card

    19
  • Stats cards with links

    Stats cards with links

    46
  • Model Grid Cards

    Model Grid Cards

    6
  • Admin Dashboard Cards

    Admin Dashboard Cards

    46
  • Interactive Tech Stack Bento Grid with Hover Effects

    Interactive Tech Stack Bento Grid with Hover Effects

    781
  • Card

    Card

    2