Expand Gallery
Grid tiles that open in place into a full view, and shrink back.
PROGet Expand Gallery and 168 other Pro components with pro lifetime — Get Pro
- Category
- Creative
- Access
- ProPro · unlocked
- Source
- 320 lines · one file
- States
- 6 drawn
The decision inside it
It opens from where it sits
The tile and the full view are one element in two layouts, so the picture flies from its place and the reader never loses what they clicked. It is a proper dialog: focus trapped, Escape and backdrop close it, focus returns to the tile. Reduced motion fades instead.
When to use it
Use Expand Gallery for a set of projects or photos where any item opens in place into a full view with details, then steps through the rest.
Installation
How you get it
Paste this into Claude Code, Cursor, Codex or any coding agent. It installs the file and uses it as it is, instead of writing a new one.
Use Liro's Expand Gallery for this.
Install it: npx shadcn@latest add @liro/expand-gallery
(the @liro registry is set up in components.json, with LIRO_KEY in .env.local)
Import it from @/components/ui/expand-gallery.
Do not rewrite or restyle it. Pass my data through its props
and keep its built-in states.For the full brief with every prop and the mistakes assistants usually make, use Copy prompt above. Pro components install through the @liro registry with your CLI token: see the Namespaced tab.
Usage
import { ExpandGallery, type GalleryItem } from "@/components/ui/expand-gallery";
const items: GalleryItem[] = [
{ id: "salt", title: "Casa Sal", category: "Residential", src: "/work/casa-sal.jpg", alt: "A white house on an ochre hill" },
{ id: "curve", title: "The Long Curve", category: "Cultural", src: "/work/curve.jpg", alt: "A curved white wall" },
];
export function Projects() {
return <ExpandGallery items={items} columns={3} />;
}API reference
“Copy prompt” above puts a full brief on your clipboard, install command, dependencies, props, and the mistakes an assistant usually makes with this component.
Props
Read from the component’s own TypeScript interface when the site is built, so this table cannot drift from the file you install.
| Type | Notes | ||
|---|---|---|---|
items | GalleryItem[] | Yes | – |
columns | number | No | Columns at full width. Default 3. |
rowHeight | number | No | Height of one grid row, in px. Default 190. |
Dependencies
npm packages
clsxframer-motionlucide-reacttailwind-mergeLiro foundations, installed alongside it
liro-themeStates
All of them are drawn by the component. None is left for you to design.
- Grid
- Opening
- Open
- Next / previous
- Closing
- Reduced motion
Accessibility
- Keyboard reachable throughout, in visual order
- Focus trapped in overlays, Escape closes them
- Focus returns to whatever opened it
- Live regions announce what changed, not that something did
- Honours prefers-reduced-motion
Responsive behavior
- Sizes to its container, not the viewport
- Usable from 320px up
- Pointer-based interaction, so trackpad and touch both work
- No hover-only affordances