{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "file-upload-4",
  "title": "Image Gallery Uploader",
  "description": "Image gallery uploader with a responsive thumbnail grid, a cover badge on the first photo, hover remove buttons, an upload tile, and an image count.",
  "dependencies": [
    "@base-ui/react"
  ],
  "registryDependencies": [
    "badge",
    "button",
    "card"
  ],
  "files": [
    {
      "path": "registry/blocks/file-upload/4/file-upload-block.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { Badge } from \"@/components/ui/badge\"\nimport { Button } from \"@/components/ui/button\"\nimport { Card, CardContent, CardHeader, CardTitle } from \"@/components/ui/card\"\nimport { IconPlaceholder } from \"@/components/icons/icon-placeholder\"\n\ntype UploadImage = { id: number; src: string; name: string }\n\nconst seed: UploadImage[] = [\n  {\n    id: 1,\n    src: \"https://images.unsplash.com/photo-1487958449943-2429e8be8625?w=400&q=80\",\n    name: \"facade.jpg\",\n  },\n  {\n    id: 2,\n    src: \"https://images.unsplash.com/photo-1449824913935-59a10b8d2000?w=400&q=80\",\n    name: \"skyline.jpg\",\n  },\n  {\n    id: 3,\n    src: \"https://images.unsplash.com/photo-1511818966892-d7d671e672a2?w=400&q=80\",\n    name: \"stairs.jpg\",\n  },\n  {\n    id: 4,\n    src: \"https://images.unsplash.com/photo-1481253127861-534498168948?w=400&q=80\",\n    name: \"bridge.jpg\",\n  },\n  {\n    id: 5,\n    src: \"https://images.unsplash.com/photo-1470723710355-95304d8aece4?w=400&q=80\",\n    name: \"atrium.jpg\",\n  },\n]\n\nconst LIMIT = 8\n\nfunction Thumbnail({\n  image,\n  isCover,\n  onRemove,\n}: {\n  image: UploadImage\n  isCover: boolean\n  onRemove: () => void\n}) {\n  return (\n    <div className=\"group relative aspect-square overflow-hidden rounded-lg border border-border bg-muted\">\n      <img\n        src={image.src}\n        alt={image.name}\n        className=\"size-full object-cover grayscale\"\n        loading=\"lazy\"\n      />\n      {isCover && (\n        <Badge variant=\"secondary\" className=\"absolute top-1.5 left-1.5\">\n          Cover\n        </Badge>\n      )}\n      <Button\n        type=\"button\"\n        size=\"icon-sm\"\n        variant=\"secondary\"\n        onClick={onRemove}\n        aria-label={`Remove ${image.name}`}\n        className=\"absolute top-1.5 right-1.5 opacity-0 transition-opacity group-hover:opacity-100 focus-visible:opacity-100\"\n      >\n        <IconPlaceholder\n          lucide=\"X\"\n          tabler=\"IconX\"\n          hugeicons=\"Cancel01Icon\"\n          phosphor=\"X\"\n          remixicon=\"RiCloseLine\"\n          aria-hidden=\"true\"\n        />\n      </Button>\n    </div>\n  )\n}\n\nexport default function FileUploadBlock() {\n  const [images, setImages] = React.useState(seed)\n\n  const remove = (id: number) =>\n    setImages((prev) => prev.filter((image) => image.id !== id))\n\n  return (\n    <section className=\"flex min-h-svh w-full items-center justify-center bg-background px-6 py-16 text-foreground\">\n      <Card className=\"w-full max-w-lg\">\n        <CardHeader className=\"flex-row items-center justify-between gap-3\">\n          <div className=\"flex items-center gap-2.5\">\n            <div className=\"flex size-9 items-center justify-center rounded-lg border border-border bg-muted\">\n              <IconPlaceholder\n                lucide=\"Image\"\n                tabler=\"IconPhoto\"\n                hugeicons=\"ImageIcon\"\n                phosphor=\"Image\"\n                remixicon=\"RiImageLine\"\n                className=\"size-4.5\"\n                aria-hidden=\"true\"\n              />\n            </div>\n            <div>\n              <CardTitle className=\"text-sm\">Gallery Images</CardTitle>\n              <p className=\"text-xs text-muted-foreground tabular-nums\">\n                {images.length} of {LIMIT} uploaded\n              </p>\n            </div>\n          </div>\n          <Button variant=\"outline\" size=\"sm\" disabled={images.length >= LIMIT}>\n            <IconPlaceholder\n              lucide=\"Plus\"\n              tabler=\"IconPlus\"\n              hugeicons=\"Add01Icon\"\n              phosphor=\"Plus\"\n              remixicon=\"RiAddLine\"\n              data-icon=\"inline-start\"\n              aria-hidden=\"true\"\n            />\n            Add\n          </Button>\n        </CardHeader>\n        <CardContent>\n          <div className=\"grid grid-cols-3 gap-2\">\n            {images.map((image, index) => (\n              <Thumbnail\n                key={image.id}\n                image={image}\n                isCover={index === 0}\n                onRemove={() => remove(image.id)}\n              />\n            ))}\n            {images.length < LIMIT && (\n              <button\n                type=\"button\"\n                className=\"flex aspect-square flex-col items-center justify-center gap-1.5 rounded-lg border border-dashed border-border bg-muted/40 text-muted-foreground transition-colors hover:border-foreground/30 hover:text-foreground\"\n              >\n                <IconPlaceholder\n                  lucide=\"Plus\"\n                  tabler=\"IconPlus\"\n                  hugeicons=\"Add01Icon\"\n                  phosphor=\"Plus\"\n                  remixicon=\"RiAddLine\"\n                  className=\"size-5\"\n                  aria-hidden=\"true\"\n                />\n                <span className=\"text-xs font-medium\">Upload</span>\n              </button>\n            )}\n          </div>\n          <p className=\"mt-3 text-xs text-muted-foreground\">\n            PNG or JPG up to 10MB. The first image is used as the cover.\n          </p>\n        </CardContent>\n      </Card>\n    </section>\n  )\n}\n",
      "type": "registry:component",
      "target": "components/blocks/file-upload-4.tsx"
    }
  ],
  "meta": {
    "height": "605px",
    "tier": "free"
  },
  "categories": [
    "file-upload"
  ],
  "type": "registry:block"
}