Skip to Content
Kokonut UI

CD-17Cards

Lightbox Grid

A photo grid whose thumbnails grow into a full view and fly back to their slot when you drag them down.

Install with
motion

PROOnboarding Checklist and more like it are in Kokonut UI Pro

Installation

Lightbox Grid is a free, open-source React component in the Kokonut UI Cards collection. Add it with the shadcn CLI, which copies the source into components/kokonutui/lightbox-grid.tsx, so the code is yours to change.

npx shadcn@latest add @kokonutui/lightbox-grid

Or add it by hand: install its packages, then copy the source from Copy code above into components/kokonutui/lightbox-grid.tsx.

npm install motion

Usage

import LightboxGrid from "@/components/kokonutui/lightbox-grid";

export default function Example() {
  return <LightboxGrid />;
}

Props

images
LightboxImage[]Default built-in
className
string

Extra classes for the root element.

LightboxImage

srcrequired
string
altrequired
string
widthrequired
number

Natural size, used to fit the open view without waiting for a load.

heightrequired
number
caption
string

Dependencies

NeedsVersionComes from
motion^12.23.25npm, installed by the CLI
cn from lib/utils.tsshadcn init
React19Your app
Tailwind CSS4Your app

No provider, font or global CSS to set up: the file works as soon as it lands.