opensourceui
GitHubTwitter/X
  1. Home
  2. Components
  3. Gallery
  4. Photo Contact Sheet
Back to Gallery

Components / Gallery

Photo Contact Sheet

Free Gallery React component — PhotoContactSheetCard. MIT licensed, copy-paste ready for Next.js and Tailwind CSS.

Film contact sheet with a 2×2 numbered frame grid and roll label header. Photographer portfolio vibes, straight from the darkroom.

Preview

Contact sheet — Roll 12A

Frame 0101
Frame 0303
Frame 0404
Frame 0202

Setup

How to use

Free for personal and commercial use. No UI attribution required. Include the MIT copyright notice when copying component source into your project. Read the MIT license.

  1. 1

    Run in your terminal:

    $npm install clsx tailwind-merge lucide-react
  2. 2

    Copy lib/cn.ts below. Skip if you already have cn().

  3. 3

    Copy the code below and create components/gallery/photo-contact-sheet-card.tsx in your project.

  4. 4

    Import and render:

    Example

    import { PhotoContactSheetCard } from "@/components/gallery/photo-contact-sheet-card";

    <PhotoContactSheetCard />

lib/cn.ts

1
2
3
4
5
6
import { type ClassValue, clsx } from "clsx";
import { twMerge } from "tailwind-merge";
 
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs));
}

components/gallery/photo-contact-sheet-card.tsx

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import Image from "next/image";
import { forwardRef, type ComponentPropsWithoutRef } from "react";
 
import { cn } from "@/lib/cn";
 
export type ContactSheetFrame = {
src: string;
number: string;
};
 
export type PhotoContactSheetCardProps = Readonly<
{
rollLabel?: string;
frames?: ContactSheetFrame[];
} & ComponentPropsWithoutRef<"div">
>;
 
const defaultFrames: ContactSheetFrame[] = [
{ src: "/wallpaper-15.png", number: "01" },
{ src: "/wallpaper-3.png", number: "03" },
{ src: "/wallpaper-11.png", number: "04" },
{ src: "/wallpaper-2.png", number: "02" },
];
 
// Production-ready Photo Contact Sheet component — styled with Tailwind CSS.
export const PhotoContactSheetCard = forwardRef<
HTMLDivElement,
PhotoContactSheetCardProps
>(
(
{
className,
rollLabel = "Contact sheet — Roll 12A",
frames = defaultFrames,
...props
},
ref,
) => (
<div
ref={ref}
data-slot="photo-contact-sheet-card"
className={cn("w-xs bg-neutral-100 p-3 font-mono", className)}
{...props}
>
<p className="mb-2 text-[9px] tracking-wider text-neutral-500 uppercase">
{rollLabel}
</p>
<div className="grid grid-cols-2 gap-2">
{frames.map((frame) => (
<div
key={frame.number}
className="group relative aspect-4/5 overflow-hidden border border-neutral-300 bg-white"
>
<Image
src={frame.src}
alt={`Frame ${frame.number}`}
fill
sizes="160px"
className="object-cover transition-transform duration-500 group-hover:scale-105"
/>
<span className="absolute top-1 left-1 bg-white/90 px-1 py-px text-[8px] font-bold text-neutral-800">
{frame.number}
</span>
</div>
))}
</div>
</div>
),
);
 
PhotoContactSheetCard.displayName = "PhotoContactSheetCard";
PreviousNext

On this

page

Jump to a section on this page.

  • lib/cn.ts
  • components/gallery/photo-contact-sheet-card.tsx

Sponsor spot · demo preview

Logo

Your brand name

Your tagline or category

A short pitch about your product or service goes here. This is a preview of how sponsor cards will look in this sidebar.

Your call to action

This slot is available. Sponsor Opensource UI and reach developers browsing components every day.