Mohammad Shehadeh

File Card

Component 1

About

A file preview component shown as a row (for lists) or a tile (for grids), with an icon based on the file type or an image preview, plus the file name, size, and custom action buttons like download or remove.

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

Code

How File Card is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

import { useState } from "react";
import { Download, X } from "lucide-react";
import { Button } from "@/components/ui/button";
import { FileCard } from "@/components/ui/file-card";

export default function FileCardDemo() {
  const [files, setFiles] = useState([
    { name: "quarterly-report.pdf", size: 1864320, type: "application/pdf" },
    { name: "team-photo.png", size: 2457600, type: "image/png" },
    { name: "budget.xlsx", size: 48210, type: "application/vnd.ms-excel" },
  ]);

  return (
    <div className="flex w-full max-w-md flex-col gap-2 p-4">
      {files.map((file) => (
        <FileCard
          key={file.name}
          name={file.name}
          size={file.size}
          type={file.type}
          actions={
            <>
              <Button variant="ghost" size="icon" aria-label="Download">
                <Download />
              </Button>
              <Button
                variant="ghost"
                size="icon"
                aria-label="Remove"
                onClick={() =>
                  setFiles((prev) => prev.filter((f) => f.name !== file.name))
                }
              >
                <X />
              </Button>
            </>
          }
        />
      ))}
    </div>
  );
}

Dependencies

More by Mohammad Shehadeh

View all
  • Ecommerce Category Page

    Ecommerce Category Page

    110
  • Feature Problem Cards

    Feature Problem Cards

    105
  • Split Login

    Split Login

    99
  • Feature Grid Spotlight Cards

    Feature Grid Spotlight Cards

    96
  • Rounded Top Footer

    Rounded Top Footer

    87
  • FAQ Two Column

    FAQ Two Column

    84
  • Comparison Section

    Comparison Section

    83
  • Comparison Table

    Comparison Table

    79

Explore more

Part of Hirael — browse the full library on 21st.dev.